Generated by remote controls and keyboards key codes used in STB applications.
At the moment keypress
and keydown
events are emitted for the same keys (for both printable and non-printable characters).
Key code is its default key code from event plus 1000 in case shift key pressed and plus 2000 in case alt key pressed.
npm install stb-keys
Add to the scope:
var keys = require('stb-keys');
In some event handler:
if ( event.code === keys.ok ) {
...
}
If you have any problem or suggestion please open an issue here. Pull requests are welcomed with respect to the JavaScript Code Style.
stb-keys
is released under the MIT License.