demo · v140

Remote Desktop Sync

The motivating use case from the chromestatus entry: a remote desktop client mirroring the local clipboard to a remote VM. Compare event-driven sync to the polling-on-focus approach Chrome Remote Desktop used to ship with — same correctness, dramatically less work.

Sync strategy:

Local (this tab)

— nothing copied yet —

Copy any text on your system to update.

Remote VM (simulated)

— not synced —

Last sync: never

Clipboard reads
0
Wasted reads (no change)
0
Syncs delivered
0

Idle — start a session and copy something.

The chromestatus motivation calls out remote desktop clients by name: today they read the clipboard on every focus event, even when nothing changed. With the event, the read only happens when there is something new to sync.

// event-driven (Chrome 140+)
navigator.clipboard.addEventListener("clipboardchange", async () => {
  const text = await navigator.clipboard.readText();
  await sendToRemote(text); // only fires when there is a real change
});

// legacy CRD-style polling
window.addEventListener("focus", async () => {
  const text = await navigator.clipboard.readText();
  if (text !== lastSeen) { lastSeen = text; await sendToRemote(text); }
});

see also