Skip to content

Commit

Permalink
Merge pull request #638 from adopted-ember-addons/key-responder-fixes
Browse files Browse the repository at this point in the history
Make keyResponder ember-modifier@4 compat
  • Loading branch information
SergeAstapov authored Jul 12, 2022
2 parents ffbade8 + 8202aba commit 0e25cd9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions addon/src/decorators/key-responder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { inject as service } from '@ember/service';
import { registerDestructor } from '@ember/destroyable';

function populateKeyboardHandlers(responder) {
responder.keyboardHandlers = responder.keyboardHandlers || {};
Expand Down Expand Up @@ -65,11 +66,10 @@ export default function keyResponder(opts = {}) {
super(...arguments);
populateKeyboardHandlers(this);
this.keyboard.register(this);
}

willDestroy() {
this.keyboard.unregister(this);
super.willDestroy(...arguments);
registerDestructor(this, () => {
this.keyboard.unregister(this);
});
}
};
};
Expand Down

0 comments on commit 0e25cd9

Please sign in to comment.