Nuanced Pumpkin Mavens

    ks

    2.0.4 • Public • Published

    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

    Install

    npm i ks

    DownloadsWeekly Downloads

    2

    Version

    2.0.4

    License

    MIT

    Last publish

    Collaborators

    • andrepolischuk