0.2.1 • Published 9 years ago

shortcuts-component v0.2.1

Weekly downloads
13
License
-
Repository
-
Last release
9 years ago

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

0.2.1

9 years ago

0.2.0

11 years ago

0.1.0

11 years ago