0.3.0 • Published 7 years ago

simple-keyboard-handler v0.3.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Simple Keyboard Handler

Build Status Coverage Status Dependency Status

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