0.0.1 • Published 8 years ago
key-code v0.0.1
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.
0.0.1
8 years ago