Key listener that returns all keys, including special characters, solves international keyboards compatibility in some scenarios.
npm install key-event-plus
keyEventListener(ms, callback)
ms
is the millisseconds between each update
callback
is the callback function
The returned object in callback function has the key
attribute and the state
attribute that can have the down
or up
value
var keyEventListener = require('key-event-plus');
window.onload = function() {
keyEventListener(20, keyEvent => {
console.log(keyEvent.key, keyEvent.state);
}
}