A singleton module to catch keyboard events and then fire callbacks.
If you require this in your project it will automatically be initalized and add an eventListener.
var keyBoardHandler = require( "simple-keyboard-handler" );
// Maps SHIFT+K to the passed function
keyBoardHandler.addShortcut( {
keyCode: 75 // keycode for 'k'
ctrl: false // defaults to false
shift: true // defaults to false
alt: false // defaults to false
}, function () {
console.log( "This is my callback." );
} );
If you don't know a keycode, checkout keycode.info