| connectToOpener | Call from the opened (child) window to connect back to its opener. Throws synchronously when there is no opener or no ue-cid parameter — i.e. the page was not opened via openWindow(). |
| createChannel | Typed pub/sub over the same-origin bus. |
| createLeader | Elects exactly one client on the bus to hold a seat: the tab that owns the WebSocket, polls, or refreshes the token, while the others stand by. |
| createPresence | Tracks the other tabs/windows/workers on this bus. Any message from a peer counts as a liveness signal (state patches, events, and presence pings all piggyback); explicit 'bye' or silence past pruneAfterMs removes them. |
| createSharedStore | State synced across every same-origin tab/window/worker: per-key last-writer-wins version clocks and a hello/snapshot late-joiner handshake. Create at most one store per name per tab (the React package memoizes). |
| defaultTransport | Default factory: real BroadcastChannel when available, otherwise a local no-op. |
| defineChannel | Bind a channel name and message map once, at module level, and get fully typed hooks back. Sugar over useChannel/useMessage/useSend — the same page-wide channel singleton is shared, so mixing bound and standalone hooks for one name is safe. |
| defineStore | Bind a store name — and optionally persistence — once, at module level. |
| enableDebug | Log every wire on a bus to the console. Returns a function to stop. |
| getBusNames | Names of the buses currently alive on this page. Buses built with a custom transport (tests) bypass the registry, so they are not listed. |
| getLeader | One Leader per name per tab. Eligibility is deliberately not part of the key: two Leaders on one name would share a bus and a clientId, and since a post never loops back locally, neither would ever see the other's claims. Timing options are first-wins, like every other engine here. |
| getSharedStore | Imperative access to the store behind useSharedState (patch logs, non-React code). |
| isBroadcastChannelAvailable | - |
| localStorageAdapter | Survives closing every tab. |
| newer | Is a newer than b? Last-writer-wins; equal counters break ties by clientId. |
| observeBus | Watch every wire crossing the named bus, in both directions. Outbound wires are the interesting half: a post goes straight to the transport, so without this seam nothing this client says is visible to it. |
| openWindow | Open a window (possibly on another origin) and get a typed 1:1 channel to it. The child must call connectToOpener(). Every received message is validated: event.origin, envelope brand, per-connection nonce, and event.source. |
| sessionStorageAdapter | Survives reloads, but dies with the tab. |
| useChannel | Get the page-wide typed channel for name (one instance per name). |
| useClientId | This client's own id on the presence bus (matches patch origin ids). |
| useIsLeader | Is this tab the leader? |
| useLeader | Who currently holds the seat on this bus, and whether it is us. Exactly one tab leads; opening another does not steal it, and closing the leader hands it over at once. |
| useLeaderEffect | Run an effect only in the tab that holds the seat, and tear it down when the seat moves. The one place to put "exactly one tab owns the socket". |
| useMessage | Subscribe to one message type. The handler is kept fresh without resubscribing, so it may close over render state. |
| useOpenedWindow | Drive an openWindow() flow from a component: the factory is called on open(), and the child window's lifecycle is folded into render state. Reopening replaces the previous window; a stale window's outcome is ignored. |
| usePeers | The other tabs/windows/workers currently alive on this origin. |
| useSend | The channel's post function (stable identity per channel). |
| useSharedState | Like useState, but the value exists in every tab, window, and worker on this origin. Late-joining tabs hydrate to the current value; concurrent writes converge last-writer-wins. Pass options.scope to delimit how much is shared ('everywhere' |
| webStorageAdapter | Persist to any Storage-shaped thing. |