provides english keyboard (used as a widget for browserling)
JavaScript CSS
Latest commit 6461c6d Apr 5, 2014 @pkrumins fix #1

readme.markdown

Keyboard

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

Example

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

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

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 (key, keyCode, keyScanCode) { })

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

Install

With npm do:

npm install keyboard2

Use browserify to require('keyboard2').

License

MIT