Skip to content

Commit

Permalink
Extend to all interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
park9140 committed Mar 3, 2015
1 parent c0c420c commit 07305d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion angular-hotkeys/angular-hotkeys-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ var hotkeyProvider: ng.hotkeys.HotkeysProvider;
var hotkeyObj: ng.hotkeys.Hotkey;

hotkeyProvider.add("mod+s", "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => {} );
hotkeyProvider.add(["mod+s"], "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => {} );
hotkeyProvider.add(hotkeyObj);
hotkeyProvider.bindTo(scope);
hotkeyProvider.del("mod+s");
hotkeyProvider.del(["mod+s"]);
hotkeyProvider.get("mod+s");
hotkeyProvider.get(["mod+s"]);
hotkeyProvider.toggleCheatSheet();

hotkeyProvider.add(hotkeyObj.combo, hotkeyObj.description ,hotkeyObj.callback);
Expand All @@ -21,7 +24,7 @@ hotkeyProvider.bindTo(scope)
combo: 'w',
description: 'blah blah',
callback: function() {}
});
})
.add({
combo: ['w', 'mod+w'],
description: 'blah blah',
Expand Down
12 changes: 6 additions & 6 deletions angular-hotkeys/angular-hotkeys.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,33 @@ declare module ng.hotkeys {
cheatSheetHotkey: string;
cheatSheetDescription: string;

add(combo: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;
add(combo: string|string[], callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;

add(combo: string, description: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;
add(combo: string|string[], description: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;

add(hotkeyObj: ng.hotkeys.Hotkey): ng.hotkeys.Hotkey;

bindTo(scope : ng.IScope): ng.hotkeys.HotkeysProviderChained;

del(combo: string): void;
del(combo: string|string[]): void;

del(hotkeyObj: ng.hotkeys.Hotkey): void;

get(combo: string): ng.hotkeys.Hotkey;
get(combo: string|string[]): ng.hotkeys.Hotkey;

toggleCheatSheet(): void;

purgeHotkeys(): void;
}

interface HotkeysProviderChained {
add(combo: string, description: string, callback: (event: Event, hotkeys: ng.hotkeys.Hotkey) => void): HotkeysProviderChained;
add(combo: string|string[], description: string, callback: (event: Event, hotkeys: ng.hotkeys.Hotkey) => void): HotkeysProviderChained;

add(hotkeyObj: ng.hotkeys.Hotkey): HotkeysProviderChained;
}

interface Hotkey {
combo: string | string[];
combo: string|string[];
description?: string;
callback: (event: Event, hotkey: ng.hotkeys.Hotkey) => void;
action?: string;
Expand Down

0 comments on commit 07305d7

Please sign in to comment.