1.0.2 • Published 4 years ago
key-listener v1.0.2
#key-listener
A handler for adding listeners to key events without taking care of keys codes.
var KeyListener = require('key-listener');
var handler = new KeyListener();
handler.addListener(document, 'a', function(){
console.log("Hello World");
});
//This is going write Hello World when the letter 'a' is pressed.
//If you really want to work with the codes and add your function as you like...
handler.getKey('backspace'); // 8
handler.getKey(16); // shift