# user-input-keyboard

> Keyboard input tracking as 0 or 1.

Latest version **0.4.3** (published 2019-06-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install user-input-keyboard
pnpm add user-input-keyboard
yarn add user-input-keyboard
bun add user-input-keyboard
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.3 |
| Published | 2019-06-22 |
| First published | 2016-01-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | apexearth@gmail.com |
| Maintainers | apexearth |
| Keywords | user, input |

## Links

- npm: https://www.npmjs.com/package/user-input-keyboard
- Repository: https://github.com/apexearth/user-input-keyboard
- Homepage: https://github.com/apexearth/user-input-keyboard#readme
- Issues: https://github.com/apexearth/user-input-keyboard/issues
- npm.io page: https://npm.io/package/user-input-keyboard

## Dependencies (1)

- [key-events](https://npm.io/package/key-events.md) 0.1.0

## Recent versions

- 0.4.3 (latest) — 2019-06-22
- 0.4.2 — 2019-06-22
- 0.4.1 — 2017-06-11
- 0.4.0 — 2017-06-11
- 0.3.0 — 2016-09-07
- 0.1.0 — 2016-09-07
- 0.0.1 — 2016-01-20

## README

# user-input-keyboard

![](https://travis-ci.org/apexearth/user-input-keyboard.svg)
![](http://img.shields.io/npm/v/user-input-keyboard.svg?style=flat)
![](http://img.shields.io/npm/dm/user-input-keyboard.svg?style=flat)
![](http://img.shields.io/npm/l/user-input-keyboard.svg?style=flat)

Keyboard input tracking as 0 or 1. 

Useful for applications which require tracking of key states.

## Usage

[![NPM](https://nodei.co/npm/user-input-keyboard.png)](https://nodei.co/npm/user-input-keyboard/)

### 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`

---
_Source: https://npm.io/package/user-input-keyboard · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
