Skip to content

Any key pressed trigger doesn't work #217

Description

@idkhow2type

Issue

new Trigger(Trigger.KEY_PRESSED, { key: "any" }, this.whenKeyAnyPressed) doesn't run this.whenKeyAnyPressed

Fix

Add this._onKeyDown('any'); to _keydown method, i.e:

private _keydown(e: KeyboardEvent): void {
  e.preventDefault();

  const key = this._getKeyName(e);
  if (this.keys.indexOf(key) === -1) {
    this.keys.push(key);
  }

  this._onKeyDown(key);
  this._onKeyDown('any');
}

(Should I make a pull request? This is my first time contributing)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions