Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2015
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Key () {
  2.   var pressed = {},
  3.       eventHandlers = {};
  4.  
  5.   function getKeyEvent (e) {...};
  6.   document.addEventListener()...
  7.  
  8.   ['press', 'down', 'up'].forEach(function(event) {
  9.     this[event] = function (callback) {
  10.       var hendler = eventHandlers[event] = eventHandlers[event] || [];
  11.       eventHandlers[event].push(callback);
  12.     }
  13.   }, this);
  14.  
  15.   this.pressed = function (keycode, callback){...}
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement