How to use the ember-keyboard.getCode 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 smile-io / ember-polaris / addon / components / polaris-text-field.js View on Github external
handleKeyPress(event) {
      let { key } = event;
      let type = this.get('type');
      let numbersSpec = /[\d.eE+-]$/;

      if (
        type !== 'number' ||
        getCode(event) === 'Enter' ||
        key.match(numbersSpec)
      ) {
        return;
      }

      event.preventDefault();
    },
  },
github code-corps / code-corps-ember / app / components / skills-textfield.js View on Github external
keyDown(e) {
    let key = getCode(e);
    switch (key) {
      case 'ArrowDown':
      case 'ArrowUp':
      case 'Comma':
      case 'Enter':
        e.preventDefault();
        break;
      default:
        this._super(...arguments);
    }
    get(this, 'getKeyDown')(key);
  }
});