Skip to content

Should fire events instead of using passive model #4

@AshleyScirra

Description

@AshleyScirra

(This is based on an email sent to public-webapps)

The Gamepad API is the only web platform input API that relies on passively polling the input state. Gamepads should fire events like "gamepadbuttondown", "gamepadbuttonup" and "gamepadaxismove". This would have the following benefits:

  • consistent with other input APIs (e.g. "mousedown", "mouseup", "mousemove" / "touchstart", "touchmove", "touchend" / "pointerdown", "pointermove", "pointerup")
  • easier to program for: if you want a "gamepadbuttondown" event, you have to implement it yourself by polling the state, keeping the previous polled state, and comparing the differences looking for a previously up but currently down state and then run your handler
  • easily integrates with browser's existing "user gesture" model for sensitive features like opening popup windows, copying to the clipboard, and playing audio or video on mobile. Since gamepads do not fire events, currently it is not possible to use any "user gesture" features with gamepad input alone in any existing browsers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions