1.0.0-rtm.4 • Published 8 years ago

cycle-keyboard v1.0.0-rtm.4

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

cycle-keyboard

A keyboard driver for cycle.js. View Demo

npm versionlicense

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 additional displayKey property, optionally filtered by a key code or a key name
  • downs(key?: number|string), a stream of all keydown events emitted on the document, with an additional displayKey property, optionally filtered by a key code or a key name
  • presses(key?: number|string), a stream of all keypress events emitted on the document, with additional displayKey and displayChar properties, optionally filtered by a key code or a key name
  • shift$, a stream of booleans indicating if the shift key is held down, and
  • capsLock$, a stream of booleans indicating if the caps lock is on
1.0.0-rtm.4

8 years ago

1.0.0-rtm.3

8 years ago

1.0.0-rtm.2

8 years ago

1.0.0-alpha.206

8 years ago

1.0.0-alpha.204

8 years ago

1.0.0-alpha.203

8 years ago

1.0.0-alpha.201

8 years ago

1.0.0-rtm.1

8 years ago

1.0.0-alpha.11

8 years ago

1.0.0-alpha.10

8 years ago

1.0.0-alpha.8

8 years ago

1.0.0-alpha.7

8 years ago

1.0.0-alpha.6

8 years ago

1.0.0-alpha.5

8 years ago

1.0.0-alpha.4

8 years ago

1.0.0-alpha.3

8 years ago

1.0.0-alpha.2

8 years ago

1.0.0-alpha.1

8 years ago

1.0.0-rc.8

8 years ago

1.0.0-rc.7

8 years ago

1.0.0-rc.6

8 years ago

1.0.0-rc.5

8 years ago

1.0.0-rc.4

8 years ago

1.0.0-rc.3

8 years ago

1.0.0-rc.2

8 years ago

1.0.0-rc.1

8 years ago

0.12.0

8 years ago

0.11.1

8 years ago

0.11.0

8 years ago

0.10.4

8 years ago

0.10.3

8 years ago

0.10.2

8 years ago

0.10.1

8 years ago

0.10.0

8 years ago

0.9.1

8 years ago

0.9.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago