Shortcut
Assign functions to keypress
events
Usage
var shortcut = processstdin processstdinprocessstdin // shortcut assignment // multiple shortcuts bound to one function // get event and handler data
Installation
npm install shortcut
require('shortcut')(ReadableStream)
If the ReadableStream
is not emiting keypress
events then the stream will be passed into keypress
Returns the shortcut library listening to ReadableStream
shortcut(string, fn)
string
: A combination ofModifiers
joined by+
and terminated with a single key. You can join shortcuts with a comma,
to assign multiple to one function.fn
: Will be called with the keypress event and the shortcut handler
Modifiers
shift
:⇧
,shift
ctrl
:^
,ctrl
,control
meta
:⌥
,meta
,alt
,option
Inspiration
This module is heavily inspired by Thomas Fuchs' keymaster library.
License
MIT