Documentation / @etherfold/browser / stateMovedChannelName
Function: stateMovedChannelName() ​
stateMovedChannelName(
storage?):string
Defined in: packages/browser/src/stateMovedAcrossTabs.ts:65
THE CHANNEL A STORE'S NOTIFICATIONS TRAVEL ON, composed from the STORAGE IDENTITY and nothing else.
This is the whole scoping rule, and it is the writer token's rule rather than a new one: the token's scope is one unit of STORAGE precisely because the token lives inside the storage it guards, which is why two unrelated indexers on one origin never contend. On the browser default that identity is the databaseName (CONTEXT.md, storage identity), so that is what names the channel -- two tabs of one store hear each other, two apps sharing an origin do not, and neither of those had to be arranged.
What it deliberately is NOT scoped to is an ORIGIN, a TAB, a connection or a name an app invented, each of which breaks the first of those silently: two indexers on one origin would be told about each other's blocks and would invalidate caches over state they do not hold. The glossary says this in as many words about the token, and the channel follows it for the same reason -- one fact, two mechanisms that must not disagree.
stateMovedChannelName({databaseName: 'my-app-state'}); // 'etherfold/state-moved/my-app-state'Exported because a test, a diagnostic or a devtool wants to NAME the channel without opening one; an application does not need it.
Parameters ​
storage? ​
CrossTabStateStorage = {}
Returns ​
string