nl_tokens: KeyboardShortcuts accepts an array of objects representing key - bindings and creates an EventEmitter which emits an event when a keyboard shortcut is triggered .
pl_tokens: function KeyboardShortcuts ( keyBindings ) { if ( ! ( this instanceof KeyboardShortcuts ) ) { return new KeyboardShortcuts ( keyBindings ) ; } // the last key and when it was pressed this . lastKey = undefined ; this . lastKeyTime = undefined ; // the time limit for determining whether two keys in order represent a key sequence this . timeLimit = 2000 ; // save a copy of the bound last-key-pressed handler so it can be removed later this . boundKeyHandler = this . handleKeyPress . bind ( this ) ; // is the notifications panel open? If so we don't fire off key-handlers this . isNotificationsOpen = <mask> ; // bind the shortcuts if this is a browser environment if ( typeof window !== 'undefined' ) { keymaster . filter = ignoreDefaultAndContentEditableFilter ; this . bindShortcuts ( keyBindings ) ; } }