demo · v149

Latency Comparator

Plug in a controller and press buttons, or run the keyboard-free simulator. Each panel shows the interval between detected input changes — polled vs event-driven. Lower interval = more granular input.

no controller detected — connect a gamepad and press any button
Checking rawgamepadinputchange support…
simulate inputs

method

navigator.getGamepads() in rAF

ms between detected changes 0 changes seen
max interval: ms

method

rawgamepadinputchange event

ms between events 0 events seen
max interval: ms events missed by polling: 0

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);
});

// Simulation path for hardware-free testing:
// emit 240Hz synthetic transitions; rAF polling can only see one per frame.

see also

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗