Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ichord/simple-hotkeys
simple hotkeys.
https://github.com/ichord/simple-hotkeys
Last synced: 2 months ago
JSON representation
simple hotkeys.
- Host: GitHub
- URL: https://github.com/ichord/simple-hotkeys
- Owner: ichord
- License: mit
- Created: 2014-12-04T04:13:35.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2019-04-17T09:09:49.000Z (over 5 years ago)
- Last Synced: 2024-11-03T14:37:59.464Z (2 months ago)
- Language: JavaScript
- Size: 25.4 KB
- Stars: 3
- Watchers: 2
- Forks: 26
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
simple-hotkeys
=============### Options
* el - jQuery selector / jQuery Object / Node;
If you want to bind hotkeys to dynamic adding element, please pass a selector as `el`.
If the `el` is null or doesn't exist, `document` element would be used by default.### Api
* add(shortcut, callback(e)) - add a hotkey.
* remove(shortcut) - remove a hotkey
* destroy() - off events and clean up.### Usage
```javascript
hotkeys = simple.hotkeys();
hotkeys.add("ctrl + b", function(e){
console.log("ctrl + b pressed");
}).add("ctrl + h"], function(e){
console.log("Help");
});
```