Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A tiny little keycode library
CoffeeScript
Tag: 0.1.6

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
client
src
test
.gitignore
.npmignore
.travis.yml
Jakefile.coffee
README.md
package.json

README.md

Key

Key is a tiny little keycode library for your browser. It makes keybound event assertions super simple.

Build Status

Installation

Browser

To use Key without a package manager in-browser, copy/link to client/key.js or client/key.min.js and start using.

NPM

Just install with npm install key or add it to your package.json

Usage

Key is bound to the window object, so usage in the browser is simple

var key = window.key

Key will also work fine with a dependency manager like Browserify (both Javascript and CoffeeScript).

var key = require('key')

Example

pressed = 13; // An event keycode (eg jQuery.event.which)

key.get(pressed).name; // "Enter"
key.is(key.code.special.enter, pressed); // true
key.is(key.code.alnum.a, pressed); // false

License

The content of this library is released under the MIT License by Andrew Lawson.
You can find a copy of this license at http://www.opensource.org/licenses/mit

Something went wrong with that request. Please try again.