From ba945bd8667d300638a01812e17a1622f4c5e967 Mon Sep 17 00:00:00 2001 From: Antoine Pultier Date: Fri, 25 Jul 2014 14:23:17 +0200 Subject: [PATCH] Angular-hotkeys : Chaining when hotkeys is bound to a $scope object --- angular-hotkeys/angular-hotkeys-tests.ts | 9 +++++++++ angular-hotkeys/angular-hotkeys.d.ts | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/angular-hotkeys/angular-hotkeys-tests.ts b/angular-hotkeys/angular-hotkeys-tests.ts index 66f9e6072..a065d4b21 100644 --- a/angular-hotkeys/angular-hotkeys-tests.ts +++ b/angular-hotkeys/angular-hotkeys-tests.ts @@ -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() {} + }); + diff --git a/angular-hotkeys/angular-hotkeys.d.ts b/angular-hotkeys/angular-hotkeys.d.ts index cc4a3680c..f209fbe08 100644 --- a/angular-hotkeys/angular-hotkeys.d.ts +++ b/angular-hotkeys/angular-hotkeys.d.ts @@ -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;