Skip to content

Interface: StateEngine\<T\>

@roomful/core


@roomful/core / StateEngine

Defined in: packages/core/src/types.ts:1369

Exposes shared-state operations for a room.

T

The shared state value type.

get(): T

Defined in: packages/core/src/types.ts:1375

Reads the latest shared state value.

T

The current shared state value.


patch(partial): void

Defined in: packages/core/src/types.ts:1391

Partially updates a shared object state. Merges into the existing value.

Partial<T>

The partial state value to merge.

void

Nothing.


reset(): void

Defined in: packages/core/src/types.ts:1413

Restores the shared state to its initial value.

void

Nothing.


set(value): void

Defined in: packages/core/src/types.ts:1383

Replaces the shared state value. Overwrites the existing value.

T

The next shared state value.

void

Nothing.


subscribe(cb): Unsubscribe

Defined in: packages/core/src/types.ts:1399

Subscribes to shared-state changes.

(value, meta) => void

The callback invoked with the latest value and metadata.

Unsubscribe

A function that removes the listener.


undo(): void

Defined in: packages/core/src/types.ts:1406

Reverts the most recent shared-state change when possible.

void

Nothing.