2.0.4 • Published 9 years ago

ks v2.0.4

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

ks

Keyboard shortcuts

Install

npm install --save ks
component install andrepolischuk/ks

Usage

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, control
  • alt, option
  • shift

Special

  • escape, esc
  • `
  • -
  • =
  • backspace
  • tab
  • \
  • [
  • ]
  • ;
  • '
  • enter, return
  • ,
  • .
  • /
  • space
  • pause, break
  • insert
  • delete
  • home
  • end
  • pageup
  • pagedown
  • left
  • up
  • right
  • down
  • windows, command
  • capslock
  • numlock
  • scrolllock
  • f1-f19

License

MIT

2.0.4

9 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago