keyboard shortcuts, similiar to component/events.
$ component install yields/shortcuts
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){};
Bind shortcuts on the given el
with obj
.
k instance
Bind keys
with method
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
MIT