utils/keybinding.js
function addMethod (char, method) {
  var keyIsBound = hasKeybinding(char);
  var listener = keyupHandler.bind(null, char, method);

  bindings[char] = bindings[char] || {methods: [], listeners: []};

  if (keyIsBound) window.removeEventListener('keyup', bindings[char].listeners[0]);

  bindings[char].methods.unshift(method);
  bindings[char].listeners.unshift(listener);
  window.addEventListener('keyup', listener);
}
function addMethod (char, method) {
  var keyIsBound = hasKeybinding(char);
  var listener = keyupHandler.bind(null, char, method);

  bindings[char] = bindings[char] || {methods: [], listeners: []};

  if (keyIsBound) window.removeEventListener('keyup', bindings[char].listeners[0]);

  bindings[char].methods.unshift(method);
  bindings[char].listeners.unshift(listener);
  window.addEventListener('keyup', listener);
}
function addMethod ( char , method ) { var keyIsBound = hasKeybinding ( char ) ; var listener = keyupHandler . bind ( null , char , method ) ; bindings [ char ] = bindings [ char ] || { methods : [ ] , listeners : [ ] } ; if ( keyIsBound ) window . removeEventListener ( 'keyup' , bindings [ char ] . listeners [ 0 ] ) ; bindings [ char ] . methods . unshift ( method ) ; bindings [ char ] . listeners . unshift ( listener ) ; window . addEventListener ( 'keyup' , listener ) ; }
- Adds the event to window and the methods to bindings - @arg {String} char     - the character key to be bound - @arg {Function} method - the callback handler to call
- Adds the event to window and the methods to bindings -