GithubHelp home page GithubHelp logo

hkkcngz / ks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andrepolischuk/ks

0.0 0.0 0.0 63 KB

Keyboard shortcuts

Home Page: http://andrepolischuk.github.io/ks/

License: MIT License

JavaScript 100.00%

ks's Introduction

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

Related

  • keycodes โ€” key codes and names
  • keycomb โ€” key combinations parser

License

MIT

ks's People

Contributors

andrepolischuk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.