Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thiagogarbazza/key-code
Library for key-code constants in ECMAScript/Javascript
https://github.com/thiagogarbazza/key-code
ecmascript enumeration javascript keyboard-code keyboard-key-code
Last synced: about 1 month ago
JSON representation
Library for key-code constants in ECMAScript/Javascript
- Host: GitHub
- URL: https://github.com/thiagogarbazza/key-code
- Owner: thiagogarbazza
- License: mit
- Created: 2016-07-25T16:56:10.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-14T11:43:03.000Z (over 6 years ago)
- Last Synced: 2024-10-01T19:16:18.113Z (about 2 months ago)
- Topics: ecmascript, enumeration, javascript, keyboard-code, keyboard-key-code
- Language: JavaScript
- Size: 15.6 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# key-code
[![Build Status](https://travis-ci.org/thiagogarbazza/key-code.svg?branch=master)](https://travis-ci.org/thiagogarbazza/key-code)
[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/thiagogarbazza/key-code/)Library for key-code constants in ECMAScript/Javascript
For more information [see this](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#Constants_for_keyCode_value).
See [key-code.js](src/key-code.js) for a full list of all the constants
## Installation
### Using NPM
```sh
npm install --save key-code
```### Using Bower
```sh
bower install --save key-code
```## Usage
### Using NodeJs
Include the package using CommonJS require()
```js
var KeyCode = require('key-code');
```or ES2015 import:
```js
// ES2015+
import KeyCode from 'key-code';
```### Using Browser
```html
```
```js
function myFunction(event) {
if (event.keyCode === KeyCode.ENTER) {
alert('keypress ENTER');
}
}
```### Using Browser via CDN - [jsdelivr](https://www.jsdelivr.com)
```html
```
```js
function myFunction(event) {
if (event.keyCode === KeyCode.ENTER) {
alert('keypress ENTER');
}
}
```## License
The `key-code` project is under MIT license.