Skip to content

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

new MemoryStateStorage(): MemoryStateStorage

MemoryStateStorage

discard(key): void

Defined in: src/client/state/memory-state-storage.ts:31

The same as remove: this store publishes nothing at all.

string

void

StateStorage.discard


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.

string

SessionState | null

StateStorage.get


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.

string

void

StateStorage.remove


set(key, state): void

Defined in: src/client/state/memory-state-storage.ts:20

string

Omit<SessionState, "held">

void

StateStorage.set


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.

string

() => void

() => void

StateStorage.subscribe