forked from jaywcjlove/hotkeys-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
53 lines (44 loc) · 1.22 KB
/
index.d.ts
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
export interface HotkeysEvent {
key: string
method: KeyHandler
mods: number[]
scope: string
shortcut: string
}
export interface KeyHandler {
(keyboardEvent: KeyboardEvent, hotkeysEvent: HotkeysEvent): void | boolean
}
type Options = {
scope?: string,
element?: HTMLElement | null,
keyup?: boolean | null
keydown?: boolean | null
splitKey?: string;
}
interface Hotkeys {
(key: string, method: KeyHandler): void
(key: string, scope: string, method: KeyHandler): void
(key: string, options: Options, method: KeyHandler): void
shift: boolean
ctrl: boolean
alt: boolean
option: boolean
control: boolean
cmd: boolean
command: boolean
setScope(scopeName: string): void
getScope(): string
deleteScope(scopeName: string): void
noConflict(): void
unbind(key: string): void
unbind(key: string, scopeName: string): void
unbind(key: string, scopeName: string, method: KeyHandler): void
unbind(key: string, method: KeyHandler): void
isPressed(keyCode: number): boolean
isPressed(keyCode: string): boolean
getPressedKeyCodes(): number[]
filter(event: KeyboardEvent): boolean
}
// https://github.com/eiriklv/react-masonry-component/issues/57
declare var hotkeys: Hotkeys
export default hotkeys;