← Back to release summary
Gamepad Event-Driven Input API
- Category
- Device
- Type
- New or changed feature
- Status
- In development (Chrome In development)
- Intent stage
- Start incubating
Summary
This proposal extends the Gamepad API with a new event-driven model that enables applications to receive gamepad input with lower latency. Instead of relying on frequent polling via navigator.getGamepads(), developers can now listen for a rawgamepadinputchange event, which fires whenever new input data is available from the device. This allows for more responsive input handling, particularly in latency-sensitive applications.
Motivation
The current Gamepad API relies on a polling-based model, where applications must repeatedly call navigator.getGamepads() and compare the entire gamepad state to detect changes such as button presses or axis movements. Introducing an event-driven alternative would allow applications to respond directly to meaningful input changes without relying on a polling loop. This approach not only simplifies input handling but may also help reduce average input latency.
Standards & signals
- Specification: https://w3c.github.io/gamepad
- Firefox: No signal — Firefox’s experimental implementation, GamepadButtonEvent: https://searchfox.org/mozilla-central/source/dom/webidl/GamepadButtonEvent.webidl ,
GamepadAxisMoveEvent: https://searchfox.org/mozilla-central/source/dom/webidl/GamepadAxisMoveEvent.webidl#9
- Safari: No signal
- Web developers: Positive — There is strong developer interest in an event-driven Gamepad API to improve responsiveness and simplify input handling. In w3c/gamepad#4 (https://github.com/w3c/gamepad/issues/4), developers have long requested events for gamepad input, citing the inefficiency of polling-based models.
Similarly, in a popular Stack Overflow thread, developers express frustration with the lack of native gamepad events and seek workarounds, underscoring unmet needs in the current API.
The existence of third-party libraries like gamecontroller.js (https://github.com/firsching/gamecontroller.js) and Gamepad-Controller (https://github.com/alvaromontoro/gamepad-controller) further demonstrates this.
- Tracking bug: https://crbug.com/40582297
Samples: https://gabrielsanbrito.github.io/gamepad-raw-input-events
Explainers: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/GamepadEventDrivenInputAPI/explainer.md
View on chromestatus.com