demo · v147
Latency Comparator
Plug in a controller and press buttons. Each panel shows the average interval between detected input changes — polled vs event-driven. Lower interval = more granular input.
no controller detected — connect a gamepad and press any button
method
navigator.getGamepads() in rAF
—
ms between detected changes
0 changes seen
method
rawgamepadinputchange event
—
ms between events
0 events seen
the code
// Polling path
function tick() {
const pads = navigator.getGamepads();
// …diff against last snapshot…
requestAnimationFrame(tick);
}
requestAnimationFrame(tick);
// Event-driven path (new in v149 OT)
addEventListener("rawgamepadinputchange", (e) => {
console.log(e.gamepad.index, e.buttons, e.axes);
});
see also
- Gamepad Event-Driven Input API — feature index
- ChromeStatus entry
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗