-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
25 lines (24 loc) · 867 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
the script is a simple JavaScript library for keyboard shortcut.
the keybinds is a factory class of Keybind[s](shortcutkey[s])
Usage:
- add Keybind(Control+y)
keybinds.add(element, 'C-y', function (event, [object Keybind]) { ... }, false)
.add(element, 'C-x', function (event, [object Keybind]) { ... }, false);
- remove Keybind
keybinds.remove([object Keybind]);
or
keybinds.removeByKey('C-y');
or
keybinds.removeByKey('C-y', element);
- get key
var textform = document.getElementById('text-form');
keybinds.getKey(textform, function(key, event) { ... });
- get Keybinds
- all keybinds
var keybinds = keybinds.getKeybinds();
- by key
var keybinds = keybinds.getKeybinds('C-y');
- by element
var keybinds = keybinds.getKeybinds(window);
- by key and element
var keybinds = keybinds.getKeybinds('C-y', window);