Merge pull request #2560 from yellowiscool/master

Angular-hotkeys : Chaining when hotkeys is bound to a $scope object
This commit is contained in:
Masahiro Wakame
2014-07-25 21:51:02 +09:00
2 changed files with 16 additions and 1 deletions
+9
View File
@@ -14,3 +14,12 @@ hotkeyProvider.toggleCheatSheet();
hotkeyProvider.add(hotkeyObj.combo, hotkeyObj.description ,hotkeyObj.callback);
hotkeyProvider.bindTo(scope)
.add(hotkeyObj)
.add(hotkeyObj)
.add({
combo: 'w',
description: 'blah blah',
callback: function() {}
});
+7 -1
View File
@@ -17,7 +17,7 @@ declare module ng.hotkeys {
add(hotkeyObj: ng.hotkeys.Hotkey): void;
bindTo(scope : ng.IScope): ng.hotkeys.HotkeysProvider;
bindTo(scope : ng.IScope): ng.hotkeys.HotkeysProviderChained;
del(combo: string): void;
@@ -26,6 +26,12 @@ declare module ng.hotkeys {
toggleCheatSheet(): void;
}
interface HotkeysProviderChained {
add(combo: string, description: string, callback: (event: Event, hotkeys: ng.hotkeys.Hotkey) => void): HotkeysProviderChained;
add(hotkeyObj: ng.hotkeys.Hotkey): HotkeysProviderChained;
}
interface Hotkey {
combo: string;
description?: string;