-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
64 lines (57 loc) · 1.82 KB
/
index.d.ts
File metadata and controls
64 lines (57 loc) · 1.82 KB
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
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) Dániel Tar, Alan Choi, Nic Barker, Piotr Błażejewicz and other contributors
// (Listed as owners in the DefinitelyTyped package metadata)
//
// This file is licensed under the MIT License.
// A copy of the license text can be found in the LICENSE-MIT file.
// All other files in the repository are licensed under the Apache 2.0 License
// which can be found in the LICENSE file.
declare namespace Mousetrap {
interface ExtendedKeyboardEvent extends KeyboardEvent {
returnValue: boolean; // IE returnValue
}
interface MousetrapOpts {
useCapture: boolean;
}
interface MousetrapStatic {
(el?: Element): MousetrapInstance;
new (el?: Element, opts?: MousetrapOpts): MousetrapInstance;
addKeycodes(keycodes: { [key: number]: string }): void;
stopCallback: (
e: ExtendedKeyboardEvent,
element: Element,
combo: string,
) => boolean;
bind(
keys: string | string[],
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
callback: (e: ExtendedKeyboardEvent, combo: string) => boolean | void,
action?: string,
): MousetrapInstance;
unbind(keys: string | string[], action?: string): MousetrapInstance;
trigger(keys: string, action?: string): MousetrapInstance;
reset(): MousetrapInstance;
}
interface MousetrapInstance {
stopCallback: (
e: ExtendedKeyboardEvent,
element: Element,
combo: string,
) => boolean;
bind(
keys: string | string[],
callback: (e: ExtendedKeyboardEvent, combo: string) => void,
action?: string,
): this;
unbind(keys: string | string[], action?: string): this;
trigger(keys: string, action?: string): this;
handleKey(
character: string,
modifiers: string[],
e: ExtendedKeyboardEvent,
): void;
reset(): this;
}
}
declare const Mousetrap: Mousetrap.MousetrapStatic;
export = Mousetrap;
export as namespace Mousetrap;