keyboard2
keyboard html widget: press button, get character
Last updated 8 years ago by pkrumins .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install keyboard2 
SYNC missed versions from official npm registry.

Keyboard

A HTML keyboard widget. Press button get bacon. Wait. Get character. Yep.

Example

var keyboard = require('slideways');
keyboard.appendTo('#keyboard');

keyboard.on('key', function (key, keyCode, keyDesc) {
    console.log('You pressed ' + keyDesc + ' (key code: ' + keyCode + ')');
}

See a live demo example.

Methods

var keyboard = keyboard()

Return a new keyboard instance.

keyboard.appendTo(target)

Append the keyboard widget to the dom element or query selector string target.

Events

keyboard.on('key', function (keyCode, keyDesc) { })

Keyboard emits key events when you press keys. The callback receives keyCode, keyDesc parameters. keyCode is the decimal key code for the pressed key. keyDesc is the key description (such as 'a', 'Enter', 'ESC', etc.)

Install

With npm do:

npm install keyboard

Use browserify to require('keyboard').

License

MIT

Current Tags

  • 0.0.1                                ...           latest (8 years ago)

1 Versions

  • 0.0.1                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2016 © taobao.org |