From abdf5206ccdf8c396400cadc557e56faa5148db5 Mon Sep 17 00:00:00 2001 From: Vincent Bortone Date: Tue, 15 Jan 2013 19:20:34 -0500 Subject: [PATCH] Initial development of type definition file for KeyboardJS 0.4.1 --- keyboardjs/keyboardjs-0.4.1.d.ts | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 keyboardjs/keyboardjs-0.4.1.d.ts diff --git a/keyboardjs/keyboardjs-0.4.1.d.ts b/keyboardjs/keyboardjs-0.4.1.d.ts new file mode 100644 index 000000000..c69f1c88a --- /dev/null +++ b/keyboardjs/keyboardjs-0.4.1.d.ts @@ -0,0 +1,45 @@ +// Type definitions for KeyboardJS 0.4.1 +// A JavaScript library for binding keyboard combos without the pain of key codes and key combo conflicts. +// Project: https://github.com/RobertWHurst/KeyboardJS +// Definitions by: Vincent Bortone +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface KeyboardJSSubBinding { + clear(): void; +} + +interface KeyboardJSBinding { + clear(): void; + on(eventName: string, callbacks?: any): KeyboardJSSubBinding; +} + +interface KeyboardJSKey { + name(keyCode: number): string[]; + code(keyName: string): any; +} + +interface KeyboardJSCombo { + active(keyCombo: string): bool; + parse(keyCombo: any): any[]; + stringify(keyComboArray: any): string; +} + +interface KeyboardJSLocale { + map: any; + macros: any[]; +} + +interface KeyboardJS { + enable(): void; + disable(): void; + activeKeys() string[]; + on(keyCombo:string, onDownCallback?: (keyEvent: Event, keysPressed: string[], keyCombo: string) => {}, onUpCallback?: (keyEvent: Event, keysPressed: string[], keyCombo: string) => {}): KeyboardJSBinding; + clear(keyCombo: string): void; + clear.key(keyName: string): void; + locale(localeName: string): KeyboardJSLocale; + locale.register(localeName: string, localeDefinition: KeyboardJSLocale): void; + macro(keyCombo:string , keyNames: string[]): void; + macro.remove(keyCombo: string): void; + key: KeyboardJSKey; + combo: KeyboardJSCombo; +} \ No newline at end of file