v147 · origin trial · device
Gamepad Event-Driven Input API
A new rawgamepadinputchange event that fires whenever a gamepad sends new input. Replaces the polling-by-rAF dance with a push-based input pipeline — lower latency, less wasted JS, and proper sub-frame ordering.
navigator.getGamepads() polling still works; the event-driven path is additive.
concepts
-
Latency Comparator
Two readouts of the same gamepad: one polled in
requestAnimationFrame, one driven byrawgamepadinputchange. The numbers in each panel are the time between input events — lower is better. -
Button timeline
Every
gamepadbuttondown,gamepadbuttonupandgamepadaxismovedrops a mark on a 5-second rolling timeline. Sub-frame events show up as separate ticks — something a 60Hz rAF poll could never capture. -
Button Visualizer
Live map of every button and axis on your connected gamepad. Each button box highlights on press and shows the raw pressure value; axis tracks move in real time — all driven by
rawgamepadinputchangeevents with a polling fallback for other browsers. -
Game Input Recorder
Records a sequence of gamepad inputs as a timestamped macro, then replays it. Uses the event-driven API to capture inputs at the device's native rate — including sub-frame events — and displays a comparison of event-driven vs rAF-polled recordings to show the fidelity difference.
-
Compatibility Lab
Detects
rawgamepadinputchange,gamepadbuttondown/up, andgamepadaxismoveevent support. Shows live gamepad connection status, logs events from a connected controller, and falls back torequestAnimationFramepolling automatically. Provides the universal input-handler pattern with both paths.
why it exists
Today the Gamepad API only exposes state via navigator.getGamepads(), which sites poll every frame. That gives you input quantised to your render cadence — typically 16ms granularity at 60Hz, and worse if the main thread stalls. High-frequency gamepads (240Hz+) feed input far faster than that. rawgamepadinputchange fires on every input change at the device's true rate, so games can read state with sub-frame fidelity and react to button presses that happened mid-frame.
references
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗