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.
Type Parameters
Section titled “Type Parameters”S = unknown
Properties
Section titled “Properties”namespace
Section titled “namespace”readonly namespace: string;The namespace string everything keys off.
Methods
Section titled “Methods”get(state): S | undefined;The last-known snapshot, or undefined before the first sync. See StateClient.get.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”S | undefined
publish()
Section titled “publish()”publish(state, initial): StateWriter<S>;Claim the single writer slot and seed the snapshot. See StateClient.publish.
Parameters
Section titled “Parameters”initial
Section titled “initial”S
Returns
Section titled “Returns”StateWriter<S>
subscribe()
Section titled “subscribe()”subscribe(state, handler): () => void;Observe the snapshot and every later update; returns an unsubscribe. See StateClient.subscribe.
Parameters
Section titled “Parameters”handler
Section titled “handler”(snapshot, rev) => void
Returns
Section titled “Returns”() => void