@barebones/keycodes
v1.0.1
Published
An npm package to provide easy key mapping
Downloads
114
Readme
Barebones KeyCodes
Barebones KeyCodes is a JavaScript utility for mapping keycodes to easy-to-use variables. For a full list of available key options view ./index.js
Installation
npm install @barebones/keycodes --save
Usage
import { ESCAPE } from @barebones/keycodes;
document.addEventListener( 'keyup', ( e ) => {
console.log(e);
switch ( e.keyCode ) {
case ESCAPE:
alert( 'ESCAPE key was pressed' );
break;
}
} );