Skip to content

Documentation / @etherfold/browser / PORT_PUSH_SUBSCRIPTIONS

Variable: PORT_PUSH_SUBSCRIPTIONS ​

const PORT_PUSH_SUBSCRIPTIONS: object

Defined in: packages/browser/src/host/envelope.ts:760

WHICH PAIR OF CASES TURNS EACH PUSH ON AND OFF, declared ONCE beside the push map itself.

A push is SUBSCRIBED TO and never broadcast, so every one of them has a subscribe/unsubscribe pair of cases (named for what they subscribe to, on the same ground the four reads are four cases). This states that pairing as DATA because a second place has to know it: a SharedWorker is handed a wire per client, so the filter that decides WHICH clients a push goes to lives in that shape (sharedWorker.ts) and would otherwise be a hand-written list of case names drifting one push behind this map.

A later push adds a key to PortPushes, its own pair of cases, and one line here -- and the satisfies below is what makes forgetting the line a compile error rather than a tab that subscribes and is never posted to.

Type Declaration ​

progress ​

readonly progress: object

progress.subscribe ​

readonly subscribe: "subscribeToProgress" = 'subscribeToProgress'

progress.unsubscribe ​

readonly unsubscribe: "unsubscribeFromProgress" = 'unsubscribeFromProgress'

stateMoved ​

readonly stateMoved: object

stateMoved.subscribe ​

readonly subscribe: "subscribeToStateMoved" = 'subscribeToStateMoved'

stateMoved.unsubscribe ​

readonly unsubscribe: "unsubscribeFromStateMoved" = 'unsubscribeFromStateMoved'