Web Locks API Playground

Several tabs of the warung’s app sell from one stock book: what is the final stock with no lock, with navigator.locks.request, and with ifAvailable and no…

Why it matters

Tabs of the same app run at the same time and fight over the same resource: a refresh token, offline sync, an upload queue. Without coordination you get a *lost update*: one write overwrites another. Web Locks gives you a cross-tab mutex from the browser itself, so you need no race-prone flag in localStorage.

The key idea

request() holds the lock while its callback runs, then lets go by itself

Common mistakes

Try it in this playground