demo · v140

Poll vs Event

Two clipboards in a foot race. Left side polls every 500 ms — the pre-Chrome-140 baseline. Right side waits for the clipboardchange event. Watch the wasted-read counter climb on the poller while the event-driven side stays at zero.

useful read wasted poll fallback polling Start the race, then copy the sample text or copy from another app.

Polling (every 500 ms)

Timer loop

0reads

0wasted (no change)

n/adetect ms

0.0read ms spent

sample-copy latency

Event-driven (clipboardchange)

Native event

0reads

0wasted event reads

n/adetect ms

0.0read ms spent

sample-copy latency

Copy text from anywhere — this page, your editor, a webpage — and watch both sides notice. Use "Copy sample text" for measured latency: the poller can wait for the next 500 ms tick, while the event-driven path reacts as soon as the browser dispatches clipboardchange.

// Polling — what Chrome remote desktop used to do.
setInterval(async () => {
  const text = await navigator.clipboard.readText();
  if (text !== last) sync(text);
}, 500);

// Event-driven — what it should do now.
navigator.clipboard.addEventListener("clipboardchange", async () => {
  const items = await navigator.clipboard.read();
  sync(items);
});

see also