1.0.0-rtm.4 • Published 9 years ago
cycle-keyboard v1.0.0-rtm.4
cycle-keyboard
A keyboard driver for cycle.js. View Demo
Usage
Install the package using node package manager
$ npm install cycle-keyboard@1.0.0-rtm.4
Import the driver in your cycle app
import { makeKeyboardDriver } from 'cycle-keyboard'
...
const drivers = {
...
keyboard: makeKeyboardDriver()
}
Subscribe to keyboard-related event streams on the driver
function main({ ..., keyboard }) {
const keyUp$ = keyboard.ups().map(ev => ev.displayKey + ' was pressed');
}
The driver provides the following xstream streams:
ups(key?: number|string)
, a stream of all keyup events emitted on the document, with an additionaldisplayKey
property, optionally filtered by a key code or a key namedowns(key?: number|string)
, a stream of all keydown events emitted on the document, with an additionaldisplayKey
property, optionally filtered by a key code or a key namepresses(key?: number|string)
, a stream of all keypress events emitted on the document, with additionaldisplayKey
anddisplayChar
properties, optionally filtered by a key code or a key nameshift$
, a stream of booleans indicating if the shift key is held down, andcapsLock$
, a stream of booleans indicating if the caps lock is on
1.0.0-rtm.4
9 years ago
1.0.0-rtm.3
9 years ago
1.0.0-rtm.2
9 years ago
1.0.0-alpha.206
9 years ago
1.0.0-alpha.204
9 years ago
1.0.0-alpha.203
9 years ago
1.0.0-alpha.201
9 years ago
1.0.0-rtm.1
9 years ago
1.0.0-alpha.11
9 years ago
1.0.0-alpha.10
9 years ago
1.0.0-alpha.8
9 years ago
1.0.0-alpha.7
9 years ago
1.0.0-alpha.6
9 years ago
1.0.0-alpha.5
9 years ago
1.0.0-alpha.4
9 years ago
1.0.0-alpha.3
9 years ago
1.0.0-alpha.2
9 years ago
1.0.0-alpha.1
9 years ago
1.0.0-rc.8
9 years ago
1.0.0-rc.7
9 years ago
1.0.0-rc.6
9 years ago
1.0.0-rc.5
9 years ago
1.0.0-rc.4
9 years ago
1.0.0-rc.3
9 years ago
1.0.0-rc.2
9 years ago
1.0.0-rc.1
9 years ago
0.12.0
9 years ago
0.11.1
9 years ago
0.11.0
9 years ago
0.10.4
9 years ago
0.10.3
9 years ago
0.10.2
9 years ago
0.10.1
9 years ago
0.10.0
9 years ago
0.9.1
9 years ago
0.9.0
9 years ago
0.3.0
9 years ago
0.2.0
9 years ago
0.1.3
9 years ago
0.1.2
9 years ago
0.1.1
9 years ago
0.1.0
9 years ago