Skip to content

apexearth/user-input-keyboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

user-input-keyboard

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published