Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.
/ shortcuts Public archive

keyboard shortcuts, similiar to component/events.

Notifications You must be signed in to change notification settings

yields/shortcuts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

keyboard shortcuts, similiar to component/events.

Resources

Stars

Watchers

Forks

Packages

No packages published