code: function (id, buttonState) {
      var buttonStates = this.buttonStates;
      var evtName;
      var buttonName;
      var previousButtonState = buttonStates[id] = buttonStates[id] || {};
      if (buttonState.pressed === previousButtonState.pressed) { return false; }
      if (buttonState.pressed) {
        evtName = 'down';
      } else {
        evtName = 'up';
      }
      this.el.emit('button' + evtName, {id: id});
      buttonName = this.mapping['button' + id];
      this.updateButtonModel(buttonName, evtName);
      previousButtonState.pressed = buttonState.pressed;
      return true;
    }
docs: Determine whether a button press has occured and emit events as appropriate.
  
  @param {string} id - id of the button to check.
  @param {object} buttonState - state of the button to check.
  @returns {boolean} true if button press state changed, false otherwise.