/key-event-plus

Improved key up and key down listener

Primary LanguageJavaScriptMIT LicenseMIT

keyEvent+

License: MIT Twitter: jeeanribeiro

Key listener that returns all keys, including special characters, solves international keyboards compatibility in some scenarios.

How to use

Installing

npm install key-event-plus

Function

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

Use example

var keyEventListener = require('key-event-plus');

window.onload = function() {
  keyEventListener(20, keyEvent => {
    console.log(keyEvent.key, keyEvent.state);
  }
}