MemoryStateStorage
Defined in: src/client/state/memory-state-storage.ts:10
State held for the lifetime of the instance and shared with nothing.
For tests, and for a client that should share its sign-in with nothing: a reload starts from nothing.
implements StateStorage
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MemoryStateStorage():
MemoryStateStorage
Returns
Section titled “Returns”MemoryStateStorage
Methods
Section titled “Methods”discard()
Section titled “discard()”discard(
key):void
Defined in: src/client/state/memory-state-storage.ts:31
The same as remove: this store publishes nothing at all.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”get(
key):SessionState|null
Defined in: src/client/state/memory-state-storage.ts:14
The state, or null where nothing is signed in within this store’s reach.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”SessionState | null
Implementation of
Section titled “Implementation of”remove()
Section titled “remove()”remove(
key):void
Defined in: src/client/state/memory-state-storage.ts:25
Removes the state, and anything this store publishes beyond this origin.
What signing out does: the user ended the sign-in, so a sibling reading a shared record must stop seeing one.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”set(
key,state):void
Defined in: src/client/state/memory-state-storage.ts:20
Parameters
Section titled “Parameters”string
Omit<SessionState, "held">
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”subscribe()
Section titled “subscribe()”subscribe(
key,listener): () =>void
Defined in: src/client/state/memory-state-storage.ts:45
Fires when the state changes, which here means when something writes to this instance.
Nothing outside the process can reach a Map, so a medium is not what makes
this worth having: two clients can be handed the same instance, and this is
how the one that did not write finds out. Each listener is told only when the
record actually changed since it was last told, so a client’s own writes do
not come back to it as news.
Parameters
Section titled “Parameters”string
listener
Section titled “listener”() => void
Returns
Section titled “Returns”() => void