Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tom32i/key-mapper.js
Simple HTML5 Input Key mapper
https://github.com/tom32i/key-mapper.js
Last synced: 21 days ago
JSON representation
Simple HTML5 Input Key mapper
- Host: GitHub
- URL: https://github.com/tom32i/key-mapper.js
- Owner: Tom32i
- License: mit
- Created: 2014-06-20T06:42:22.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-23T22:04:04.000Z (over 9 years ago)
- Last Synced: 2024-10-10T19:06:52.113Z (about 1 month ago)
- Language: JavaScript
- Homepage: http://tom32i.github.io/key-mapper.js/
- Size: 273 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
key-mapper.js
=============Simple HTML5 Input Key mapper
## Installation:
bower install --save tom32i-key-mapper.js
## Usage:
Keyboard binding:
```javascript
var mapper = new KeyboardMapper(),
listener = new InputListener(mapper, 'my-input-field');
```Gamepad binding:
```javascript
var gamepadListener = new GamepadListener({precision: 2, deadZone: 0.3}),
mapper = new GamepadMapper(gamepadListener),
listener = new InputListener(mapper, 'my-input-field');gamepadListener.start();
```Gamepad specific binding:
```javascript
var gamepadListener = new GamepadListener({precision: 2, deadZone: 0.3}),
mapper = new GamepadMapper(gamepadListener, true),
listener = new InputListener(mapper, 'my-input-field');gamepadListener.start();
```Touch binding:
```javascript
var mapper = new TouchMapper(),
listener = new InputListener(mapper, 'my-input-field');
```## Events:
Listen for value change on the mapping:
```javascript
mapper.on('change', function (event) {
/**
* event: CustomEvent
* detail: {
* value: 32,
* view: "Space"
* }
*/
});
```The touch mapper return a `Touch` object as the value.