2.0.4 • Published 10 years ago
ks v2.0.4
ks
Keyboard shortcuts
Install
npm install --save kscomponent install andrepolischuk/ksUsage
var ks = require('ks');
ks('enter', open);
ks('esc', close);
ks('ctrl+enter', send, 'edit');
ks('ctrl+/', help);API
ks(keys, fn, scope)
Attach fn to specified keys combinations and scope
ks('a', function(ctx, next) {
ctx.keys; // 'a'
});ks(fn)
Set global fn for all combinations
ks.remove(keys, fn, scope)
Detach fn
ks.scope(name)
Set specified scope
ks.scope('auth'); // ['auth']
ks.scope(); // ['auth']ks.removeScope(name)
Remove scope or clear scope list
ks.scope('auth'); // ['auth']
ks.scope('hello'); // ['auth', 'hello']
ks.removeScope('auth'); // ['hello']
ks.removeScope(); // []Keys
Modifiers
ctrl,controlalt,optionshift
Special
escape,esc`-=backspacetab\[];'enter,return,./spacepause,breakinsertdeletehomeendpageuppagedownleftuprightdownwindows,commandcapslocknumlockscrolllockf1-f19
License
MIT