forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
keyboardjs.d.ts
50 lines (44 loc) · 1.52 KB
/
keyboardjs.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
// Type definitions for KeyboardJS
// Project: https://github.com/RobertWHurst/KeyboardJS
// Definitions by: Vincent Bortone <https://github.com/vbortone/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// A JavaScript library for binding keyboard combos without the pain of key codes and key combo conflicts.
interface KeyboardJSSubBinding {
clear(): void;
}
interface KeyboardJSBinding {
clear(): void;
on(eventName: string, callbacks?: any): KeyboardJSSubBinding;
}
interface KeyboardJSLocale {
map: any;
macros: any[];
}
interface KeyboardJSStatic {
enable(): void;
disable(): void;
activeKeys(): string[];
on(keyCombo:string, onDownCallback?: (keyEvent: Event, keysPressed: string[], keyCombo: string) => void, onUpCallback?: (keyEvent: Event, keysPressed: string[], keyCombo: string) => void): KeyboardJSBinding;
clear: {
(keyCombo: string): void; // Call signature
key(keyName: string): void; // Method
};
locale: {
(localeName: string): KeyboardJSLocale; // Call signature
register(localeName: string, localeDefinition: KeyboardJSLocale): void; // Method
};
macro: {
(keyCombo:string , keyNames: string[]): void; // Call signature
remove(keyCombo: string): void; // Method
};
key: {
name(keyCode: number): string[];
code(keyName: string): any;
};
combo: {
active(keyCombo: string): boolean;
parse(keyCombo: any): any[];
stringify(keyComboArray: any): string;
};
}
declare var KeyboardJS: KeyboardJSStatic;