1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | declare namespace Mousetrap {
|
10 | interface ExtendedKeyboardEvent extends KeyboardEvent {
|
11 | returnValue: boolean;
|
12 | }
|
13 |
|
14 | interface MousetrapStatic {
|
15 | (el?: Element): MousetrapInstance;
|
16 | new (el?: Element): MousetrapInstance;
|
17 | addKeycodes(keycodes: { [key: number]: string }): void;
|
18 | stopCallback: (e: ExtendedKeyboardEvent, element: Element, combo: string) => boolean;
|
19 | bind(
|
20 | keys: string | string[],
|
21 | callback: (e: ExtendedKeyboardEvent, combo: string) => boolean | void,
|
22 | action?: string,
|
23 | ): MousetrapInstance;
|
24 | unbind(keys: string | string[], action?: string): MousetrapInstance;
|
25 | trigger(keys: string, action?: string): MousetrapInstance;
|
26 | reset(): MousetrapInstance;
|
27 | }
|
28 |
|
29 | interface MousetrapInstance {
|
30 | stopCallback: (e: ExtendedKeyboardEvent, element: Element, combo: string) => boolean;
|
31 | bind(
|
32 | keys: string | string[],
|
33 | callback: (e: ExtendedKeyboardEvent, combo: string) => void,
|
34 | action?: string,
|
35 | ): this;
|
36 | unbind(keys: string | string[], action?: string): this;
|
37 | trigger(keys: string, action?: string): this;
|
38 | handleKey(character: string, modifiers: string[], e: ExtendedKeyboardEvent): void;
|
39 | reset(): this;
|
40 | }
|
41 | }
|
42 |
|
43 | declare const Mousetrap: Mousetrap.MousetrapStatic;
|
44 |
|
45 | export = Mousetrap;
|
46 |
|
47 | export as namespace Mousetrap;
|