v149 · 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.

Heads up Origin trial. Existing navigator.getGamepads() polling still works; the event-driven path is additive.

concepts

  1. Latency Comparator

    Two readouts of the same gamepad: one polled in requestAnimationFrame, one driven by rawgamepadinputchange. The numbers in each panel are the time between input events — lower is better.

  2. Button Timeline

    Same gamepad, but plotted on two timelines over a 5-second window. The event row catches every transition; the poll row only ever samples once per frame — so rapid double-taps reveal as ticks the poll missed entirely.

  3. Input Frequency Meter

    Live Hz histogram comparing the event-driven and polling paths side by side. Tracks events per second, peak frequency, and sub-frame input count — showing exactly how many inputs the polling path misses between animation frames.

  4. Axes Explorer

    A live visualiser for all four analog axes and 16 buttons. Toggle between event-driven and polling mode — in event mode the stick dots update at device rate, in poll mode they snap to frame boundaries. Keyboard simulation included for browsers without a gamepad.

  5. Combo Detector

    Fighting-game style combos (Hadouken, Shoryuken, Super, Quick Dash) detected via an input buffer fed by rawgamepadinputchange events. Because events fire for every physical transition — including sub-frame presses — rapid double-taps and multi-input sequences are caught reliably. Includes sim buttons for browsers without a connected gamepad.

  6. Event Inspector

    Inspect the raw rawgamepadinputchange event object — its full gamepad property tree, timestamp, buttons array, and axes — with changed properties highlighted in green. Compares the event snapshot against what navigator.getGamepads() returns at the same moment. Keyboard simulation buttons fire synthetic events through the same inspector, making this useful even without a physical gamepad connected.

    Interactive DevTools Event API

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 ↗