Skip to content

@pgege/kaboo-runtime


Class: StateOwnership

Defined in: src/keys.ts:47

Applies a KabooStateKeys split to the state a run starts with and to what the browser sees.

Constructors

Constructor

new StateOwnership(keys?): StateOwnership

Defined in: src/keys.ts:51

Parameters

keys?

KabooStateKeys = DEFAULT_STATE_KEYS

Returns

StateOwnership

Methods

merge()

merge(persisted, client, host?): ThreadState

Defined in: src/keys.ts:61

The state a run starts with: the browser's keys from the client (the stored value when the client sent none), the server's keys from the store only, then whatever the host set for this run.

Parameters

persisted

ThreadState | null

client

unknown

host?

ThreadState = {}

Returns

ThreadState


visible()

visible(event): BaseEvent | null

Defined in: src/keys.ts:83

The copy of an event the browser may see, or null when none of it is visible. Only state events can carry hidden keys.

Parameters

event

BaseEvent

Returns

BaseEvent | null


visibleState()

visibleState(state): ThreadState | null

Defined in: src/keys.ts:73

Strip the hidden keys from a state value.

Parameters

state

ThreadState | null

Returns

ThreadState | null