Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const x = key => on(keyPress(key), function() { tryInvoke(this, NAMES[key], []) });
export default Component.extend(EKMixin, EKOnInsertMixin, {
didInsertElement() {
this._super(...arguments);
this.on(keyDown('ArrowLeft'), makeEventHandler(-1));
this.on(keyDown('ArrowRight'), makeEventHandler(1));
this.on(keyDown('shift+ArrowLeft'), makeEventHandler(-10));
this.on(keyDown('shift+ArrowRight'), makeEventHandler(10));
this.on(keyDown('ctrl+shift+ArrowLeft'), makeEventHandler(-100));
this.on(keyDown('ctrl+shift+ArrowRight'), makeEventHandler(100));
this.on(keyUp('KeyR'), function() {
this.set('counter', 0);
});
this.on(keyPress('Digit5'), function() {
this.set('counter', 5);
});
}
didInsertElement() {
this._super(...arguments);
if (this.onKeyUp) {
this.on(keyUp(this.key), this.onKeyUp);
}
if (this.onKeyDown) {
this.on(keyDown(this.key), this.onKeyDown);
}
if (this.onKeyPress) {
this.on(keyPress(this.key), this.onKeyPress);
}
},
});