0.4.3 • Published 5 years ago

user-input-keyboard v0.4.3

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

user-input-keyboard

npm.io npm.io npm.io npm.io

Keyboard input tracking as 0 or 1.

Useful for applications which require tracking of key states.

Usage

NPM

Example

var keyboard = window.keyboardInput(document)

When the user presses "A", keyboard will contain the following.

{
    "A": 1
}

When the user releases "A", and then presses "F", keyboard will contain the following.

{
    "A": 0,
    "F": 1
}

Intercepting Events

Events can be intercepted using the afterEvent option.

var keyboard = window.keyboardInput(document, {
    afterEvent: (key, event) => {
        // key   === vkey string of key pressed
        // event === original keyboard event
    }
})

Tests

  • Mocha
    • Test functionality in Node.js
    • npm test
  • User Test
    • Test functionality in browser.
    • npm user-test
0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.0

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago