Renamed files, fixed methods in KeyboardJSStatic.

This commit is contained in:
Vincent Bortone 2013-01-17 11:52:45 -05:00
parent 44153df2f5
commit e7ec2d7f22
2 changed files with 49 additions and 47 deletions

View File

@ -1,47 +0,0 @@
// 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 <https://github.com/vbortone/>
// 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 KeyboardJSStatic {
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;
}
declare var KeyboardJS: KeyboardJSStatic;

49
keyboardjs/keyboardjs.d.ts vendored Normal file
View File

@ -0,0 +1,49 @@
// Type definitions for KeyboardJS
// 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 <https://github.com/vbortone/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
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): bool;
parse(keyCombo: any): any[];
stringify(keyComboArray: any): string;
};
}
declare var KeyboardJS: KeyboardJSStatic;