Socket
Socket
Sign inDemoInstall

shortcuts-component

Package Overview
Dependencies
6
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    shortcuts-component

keyboard shortcuts event manager, inspired by events-component


Version published
Maintainers
1
Install size
48.6 kB
Created

Readme

Source

shortcuts

keyboard shortcuts, similiar to component/events.

Installation

$ component install yields/shortcuts

Example


function Editable(el){
  this.shortcuts = shortcuts(el, this);
  this.shortcuts.bind('command + z', 'undo');
  this.shortcuts.bind('command + b', 'bold');
}

Editable.prototype.undo = function(e){};
Editable.prototype.bold = function(e){};

API

Shortcuts

Bind shortcuts on the given el with obj.

.k

k instance

#bind

Bind keys with method

#unbind

Unbind all events, or keys or keys with method.

shortcuts.unbind('command + z', 'undo') // => unbind `undo`, `command + z`
shortcuts.unbind('command + z'); // => unbind `command + z`
shortcuts.unbind(); // => unbind all

License

MIT

FAQs

Last updated on 13 Jul 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc