Gamepad Event-Driven Input API
topic: web apisvenue: W3C Web Apps WGfrom: Microsoftvenue: Edge Explainers
### WebKittens
@marcoscaceres
### Title of the proposal
Gamepad Event-Driven Input API
### URL to the spec
https://w3c.github.io/gamepad/
### URL to the spec's repository
_No response_
### Issue Tracker URL
_No response_
### Explainer URL
https://microsoftedge.github.io/MSEdgeExplainers/GamepadEventDrivenInputAPI/explainer.html
### TAG Design Review URL
_No response_
### Mozilla standards-positions issue URL
https://github.com/mozilla/standards-positions/issues/1389
### WebKit Bugzilla URL
_No response_
### Radar URL
_No response_
### Description
The Gamepad API lacks event-driven input handling, requiring applications to poll for input state changes. This polling model makes it difficult to achieve low-latency responsiveness, as input changes can be missed between polling intervals. When an application polls at a fixed rate, the average added input delay is approximately half the polling interval. For example, polling at 60 Hz (every ~16.67 ms) introduces an average latency of ~8.33 ms, before the application can even begin to process the input.
Developers working on latency-sensitive applications, such as cloud gaming platforms, have reported needing to poll at very high frequencies (e.g., every 4 ms) to detect input as quickly as possible. However, even with aggressive polling, scripts may still struggle to react in real time, especially under heavy UI thread load or on resource-constrained devices.
An event-driven Gamepad API (similar to existing keyboard and mouse event models) would allow applications to respond immediately to input changes as they occur, reducing the reliance on polling and enabling real-time responsiveness for latency-critical use cases.
WG discussions have been happening at https://github.com/w3c/gamepad/issues/4
0 条评论