simple-keyboard-handler
v0.3.0
Published
A singleton module to catch keyboard events and then fire callbacks
Downloads
9
Maintainers
Readme
Simple Keyboard Handler
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.
Usage
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