code: function(keys) {
      var keyCodes = {};
  
      // Convert single characters to char codes.
      Object.keys(keys).forEach(function(key) {
        var value = keys[key];
        if (!isNumRE.test(key)) {
          if (key.length !== 1) {
            throw "bad key code: '" + key + "'";
          }
          key = key.charCodeAt(0);
        }
        keyCodes[key] = value;
      });
  
      var handleKey = function(keyCode, state, pressed) {
        var key = keyCodes[keyCode];
        if (key) {
          key({keyCode: keyCode, pressed:pressed});
        }
      };
  
      var handleKeyDown = function(keyCode, state) {
        handleKey(keyCode, state, true);
      };
      var handleKeyUp = function(keyCode, state) {
        handleKey(keyCode, state, false);
      };
  
      setupControllerKeys(handleKeyDown, handleKeyUp);
    }
docs: @typedef {Object} KeyEvent
  @property {number} keyCode
  @property {boolean} pressed true if pressed, false if
  released
  @memberOf module:Input
   
  Sets up handlers for specific keys
  @memberOf module:Input
  @param {Object.<string, callback>} array of keys to handler
  functions. Handlers are called with a KeyEvent
  
  @example
  
  var keys = { };
  keys["Z".charCodeAt(0)] = handleJump;
  keys["X".charCodeAt(0)] = handleShow
  keys["C".charCodeAt(0)] = handleTestSound;
  keys[Input.cursorKeys.kRight] = handleMoveRight;
  Input.setupKeys(keys);