Multi-Tab Sync Lab

Explore BroadcastChannel presence/chat, cross-tab leader election, and a live race-condition demo built on the Web Locks API. Open this page in several tabs to watch them coordinate in real time. No server upload.

This Tab

— follower

Open this page in 2–3 tabs (or windows) side by side to see live coordination below.

Connected Tabs 1

Leader Election (Web Locks API)

Every tab requests the same exclusive lock via navigator.locks.request(). Only one holder can exist at a time across the whole origin — the browser itself queues the rest. Close or reload the leader tab and the lock automatically passes to the next waiting tab.

Requesting lock…

Shared Counter — Race Condition Demo

The counter lives in localStorage and is shared by every tab. Each increment reads the value, waits a random 20–50ms (simulating real work), then writes back value + 1. Fire many increments concurrently unsafe and overlapping reads clobber each other's writes — updates go missing. Wrap the same logic in a Web Lock and every increment is serialized: none are lost.

0

Cross-Tab Activity Log