# user-input

> User input tracking for keyboard, mouse, touch, and gamepad inputs.

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

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.1 |
| Published | 2019-06-22 |
| First published | 2016-01-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Christopher Jacobs |
| Maintainers | apexearth |
| Keywords | user, input, keyboard, mouse, gamepad, touch |

## Links

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

## Dependencies (4)

- [user-input-mouse](https://npm.io/package/user-input-mouse.md) ^2.0.1
- [user-input-touch](https://npm.io/package/user-input-touch.md) ^1.0.2
- [user-input-gamepad](https://npm.io/package/user-input-gamepad.md) ^0.0.1
- [user-input-keyboard](https://npm.io/package/user-input-keyboard.md) ^0.4.1

## Recent versions

- 1.5.1 (latest) — 2019-06-22
- 1.5.0 — 2017-06-18
- 1.4.1 — 2017-06-11
- 1.3.1 — 2016-09-07
- 1.3.0 — 2016-09-07
- 1.2.1 — 2016-04-20
- 1.2.0 — 2016-04-20
- 1.1.0 — 2016-02-28
- 1.0.0 — 2016-02-18
- 0.0.2 — 2016-01-18

## README

# user-input

![](https://travis-ci.org/apexearth/user-input.svg)

User input tracking for keyboard, mouse, touch, and gamepad inputs.

## Usage

[![NPM](https://nodei.co/npm/user-input.png)](https://nodei.co/npm/user-input/)

### Example

    var input   = userInput()
        .withMouse()
        .withKeyboard()
        .withGamepad(0)
        .withTouch()
    
    input.keyboard('A') === 0
    // Press A
    input.keyboard('A') === 1
        
    input.mouse('mouse0') === 0
    // Press Left Mouse Button
    input.mouse('mouse0') === 1

    // Get instances of gamepads, in rendering loops.
    input.gamepad()
    
    input.touches        // Current touches
    input.changedTouches // Changed touches
    
    // Clear keyboard & mouse values back to zero.
    input.clear()
    
    // Set values for testing
    input.keyboard('A', 1)
    input.mouse('mouse0', 1)
    input.mouse('x', 500)
    
## Tests

- Mocha
   - Test functionality in Node.js

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