Menu

How a web page can measure your mouse's polling rate
📰

How a web page can measure your mouse's polling rate

DEV Community: tutorial·Michael Steininger·about 5 hours ago
#ptrZFWpn
#devtotutorial#devto#dev#times#mouse
Long article (1008 words) — no AI summary yet.
Reading 0:00
15s threshold

Gaming mice advertise 1000, 4000, even 8000 Hz: how often the mouse reports its position to the PC. But is yours actually running at that rate? A wireless mode, a setting in the mouse software or a cheap receiver can quietly drop it to 125 Hz.

I wanted a test that runs in the browser, with nothing to download. It turned out to be a nice tour of the Pointer Events API. Here's how it works.

1. Get every report, not every frame

The obvious approach is pointermove . The problem: browsers don't fire one pointermove per mouse report. They bundle all the moves since the last frame into one event, so you'd measure your screen's refresh rate, not your mouse.

Two APIs get around that:

pointerrawupdate (Chrome and Edge) fires for every raw report without waiting for the next frame. It only exists on HTTPS pages.

getCoalescedEvents() returns the individual events that were bundled into one.

const raw = 'onpointerrawupdate' in window ;

function handle ( e ) { if ( e .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.