key-code

0.0.1 • Public • Published

key-code

Library for key-code constants in ECMAScript/Javascript

For more information see this.

See key-code.js for a full list of all the constants

Installation

Using NPM

npm install --save key-code

Using Bower

bower install --save key-code

Usage

Using NodeJs

Include the package using CommonJS require()

var KeyCode = require('key-code');

or ES2015 import:

// ES2015+
import KeyCode from 'key-code';

Using Browser

<!-- Load files. -->
<script src="/path/to/key-code/dist/key-code.js"></script>
 
<input type="text" onkeydown="myFunction(event)">
function myFunction(event) {
    if (event.keyCode === KeyCode.ENTER) {
        alert('keypress ENTER');
    }
}

License

The key-code project is under MIT license.

Package Sidebar

Install

npm i key-code

Weekly Downloads

295

Version

0.0.1

License

MIT

Last publish

Collaborators

  • thiagogarbazza