Skip to content

Commit

Permalink
Merge pull request #147 from onlyeric23/master
Browse files Browse the repository at this point in the history
Support removing hotkeys with a specific event
  • Loading branch information
Coffee-Tea authored Jun 11, 2021
2 parents d946ba9 + 28bfc61 commit e584b8c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/hotkeys.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ export class HotkeysService {
return hotkey;
}

remove(hotkey?: Hotkey | Hotkey[]): Hotkey | Hotkey[] {
remove(hotkey?: Hotkey | Hotkey[], specificEvent?: string): Hotkey | Hotkey[] {
const temp: Hotkey[] = [];
if (!hotkey) {
for (const key of this.hotkeys) {
temp.push(this.remove(key) as Hotkey);
temp.push(this.remove(key, specificEvent) as Hotkey);
}
return temp;
}
Expand All @@ -103,7 +103,7 @@ export class HotkeysService {
const index = this.findHotkey(hotkey as Hotkey);
if (index > -1) {
this.hotkeys.splice(index, 1);
this.mousetrap.unbind((hotkey as Hotkey).combo);
this.mousetrap.unbind((hotkey as Hotkey).combo, specificEvent);
return hotkey;
}
return null;
Expand Down

0 comments on commit e584b8c

Please sign in to comment.