Skip to content

StateChannel

A typed handle to one cross-frame state namespace. It carries no connection of its own — pass the relevant StateClient (platform.state or conn.state) to each method, so the same channel works from the top-level app frame and from a modal / embedded-surface frame.

S = unknown

readonly namespace: string;

The namespace string everything keys off.

get(state): S | undefined;

The last-known snapshot, or undefined before the first sync. See StateClient.get.

StateClient

S | undefined


publish(state, initial): StateWriter<S>;

Claim the single writer slot and seed the snapshot. See StateClient.publish.

StateClient

S

StateWriter<S>


subscribe(state, handler): () => void;

Observe the snapshot and every later update; returns an unsubscribe. See StateClient.subscribe.

StateClient

(snapshot, rev) => void

() => void