@@ -18,6 +18,7 @@ type Options = {
18
18
keydown ?: boolean | null ;
19
19
capture ?: boolean
20
20
splitKey ?: string ;
21
+ single ?: boolean ;
21
22
}
22
23
23
24
export interface Hotkeys {
@@ -39,7 +40,7 @@ export interface Hotkeys {
39
40
40
41
/**
41
42
* Use the `hotkeys.setScope` method to set scope. There can only be one active scope besides 'all'. By default 'all' is always active.
42
- *
43
+ *
43
44
* ```js
44
45
* // Define shortcuts with a scope
45
46
* hotkeys('ctrl+o, ctrl+alt+enter', 'issues', function() {
@@ -48,28 +49,28 @@ export interface Hotkeys {
48
49
* hotkeys('o, enter', 'files', function() {
49
50
* console.log('do something else');
50
51
* });
51
- *
52
+ *
52
53
* // Set the scope (only 'all' and 'issues' shortcuts will be honored)
53
54
* hotkeys.setScope('issues'); // default scope is 'all'
54
55
* ```
55
56
*/
56
57
setScope ( scopeName : string ) : void ;
57
58
/**
58
59
* Use the `hotkeys.getScope` method to get scope.
59
- *
60
+ *
60
61
* ```js
61
62
* hotkeys.getScope();
62
63
* ```
63
64
*/
64
65
getScope ( ) : string ;
65
66
/**
66
67
* Use the `hotkeys.deleteScope` method to delete a scope. This will also remove all associated hotkeys with it.
67
- *
68
+ *
68
69
* ```js
69
70
* hotkeys.deleteScope('issues');
70
71
* ```
71
72
* You can use second argument, if need set new scope after deleting.
72
- *
73
+ *
73
74
* ```js
74
75
* hotkeys.deleteScope('issues', 'newScopeName');
75
76
* ```
@@ -78,13 +79,13 @@ export interface Hotkeys {
78
79
79
80
/**
80
81
* Relinquish HotKeys’s control of the `hotkeys` variable.
81
- *
82
+ *
82
83
* ```js
83
84
* var k = hotkeys.noConflict();
84
85
* k('a', function() {
85
86
* console.log("do something")
86
87
* });
87
- *
88
+ *
88
89
* hotkeys()
89
90
* // -->Uncaught TypeError: hotkeys is not a function(anonymous function)
90
91
* // @ VM2170:2InjectedScript._evaluateOn
@@ -96,7 +97,7 @@ export interface Hotkeys {
96
97
97
98
/**
98
99
* trigger shortcut key event
99
- *
100
+ *
100
101
* ```js
101
102
* hotkeys.trigger('ctrl+o');
102
103
* hotkeys.trigger('ctrl+o', 'scope2');
@@ -115,7 +116,7 @@ export interface Hotkeys {
115
116
isPressed ( keyCode : string ) : boolean ;
116
117
/**
117
118
* Returns an array of key codes currently pressed.
118
- *
119
+ *
119
120
* ```js
120
121
* hotkeys('command+ctrl+shift+a,f', function() {
121
122
* console.log(hotkeys.getPressedKeyCodes()); //=> [17, 65] or [70]
@@ -125,7 +126,7 @@ export interface Hotkeys {
125
126
getPressedKeyCodes ( ) : number [ ] ;
126
127
/**
127
128
* Returns an array of key codes currently pressed.
128
- *
129
+ *
129
130
* ```js
130
131
* hotkeys('command+ctrl+shift+a,f', function() {
131
132
* console.log(hotkeys.getPressedKeyString()); //=> ['⌘', '⌃', '⇧', 'A', 'F']
@@ -135,7 +136,7 @@ export interface Hotkeys {
135
136
getPressedKeyString ( ) : string [ ] ;
136
137
/**
137
138
* Get a list of all registration codes.
138
- *
139
+ *
139
140
* ```js
140
141
* hotkeys('command+ctrl+shift+a,f', function() {
141
142
* console.log(hotkeys.getAllKeyCodes());
@@ -145,15 +146,15 @@ export interface Hotkeys {
145
146
* // ]
146
147
* })
147
148
* ```
148
- *
149
+ *
149
150
*/
150
151
getAllKeyCodes ( ) : Omit < HotkeysEvent , 'method' | 'key' > ;
151
152
152
153
/**
153
154
* By default hotkeys are not enabled for `INPUT` `SELECT` `TEXTAREA` elements.
154
155
* `Hotkeys.filter` to return to the `true` shortcut keys set to play a role,
155
156
* `false` shortcut keys set up failure.
156
- *
157
+ *
157
158
* ```js
158
159
* hotkeys.filter = function(event){
159
160
* return true;
@@ -165,7 +166,7 @@ export interface Hotkeys {
165
166
* var tagName = target.tagName;
166
167
* return !(target.isContentEditable || tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA');
167
168
* }
168
- *
169
+ *
169
170
* hotkeys.filter = function(event){
170
171
* var tagName = (event.target || event.srcElement).tagName;
171
172
* hotkeys.setScope(/^(INPUT|TEXTAREA|SELECT)$/.test(tagName) ? 'input' : 'other');
0 commit comments