How to use the ember-keyboard.keyPress function in ember-keyboard

To help you get started, we’ve selected a few ember-keyboard examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github foxnewsnetwork / ember-large-list / tests / dummy / app / components / on-navkey / component.js View on Github external
const x = key => on(keyPress(key), function() { tryInvoke(this, NAMES[key], []) });
export default Component.extend(EKMixin, EKOnInsertMixin, {
github briarsweetbriar / ember-keyboard / tests / dummy / app / components / key-down-counter.js View on Github external
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);
    });
  }
github smile-io / ember-polaris / addon / components / key-event-listener.js View on Github external
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);
    }
  },
});