From 8202aba9906d64552327d839b7759ab143b38c3b Mon Sep 17 00:00:00 2001 From: NullVoxPopuli Date: Wed, 6 Jul 2022 18:29:33 -0400 Subject: [PATCH] Make keyResponder ember-modifier@4 compat --- addon/src/decorators/key-responder.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addon/src/decorators/key-responder.js b/addon/src/decorators/key-responder.js index 8ac9c5567..91ab5c68a 100644 --- a/addon/src/decorators/key-responder.js +++ b/addon/src/decorators/key-responder.js @@ -1,4 +1,5 @@ import { inject as service } from '@ember/service'; +import { registerDestructor } from '@ember/destroyable'; function populateKeyboardHandlers(responder) { responder.keyboardHandlers = responder.keyboardHandlers || {}; @@ -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); + }); } }; };