cyclejs-community / cycle-keyboard

A keyboard driver for cycle.js
MIT License
9 stars 2 forks source link

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: