A REAL SHARED-MEMORY PLAYGROUND

New edits.
Unchanged history.

Start a real dedicated worker. Headphones start with 12 units in stock. Mark them as sold out, then compare the live catalog with the worker's retained snapshot.

Preparing this demo…
MAIN THREAD / OWNER

Current state

—units

Not loaded

state.current.stock.get('headphones')

Updates synchronously.

WORKER / RECEIVED

Latest snapshot

—units

Not loaded

shared.current.stock.get('headphones')

Receives new roots asynchronously.

WORKER / RETAINED

First snapshot

—units

Not loaded

initial.stock.get('headphones')

Stays unchanged after later edits.

LIVE EVENT LOGActual worker messages
  1. Ready. No worker is running yet.

What to notice

The owner changes first. The worker sees the new value after a snapshot arrives. Its first snapshot still shows 12 units in stock, even when the current value is zero.

Each collection read happens locally, outside any task. The worker sends small reports only so this page can display the results.

Build this into your app →

This uses the real source build shipped with this site. Disconnect releases the session and terminates this worker. Browser page navigation also ends the demo. This is a local catalog view, not stock reservation; checkout still needs server validation.

Type a topic to find a guide.

↓ ↑ to move · Enter to open · Esc to close

Browse documentation →