Skip to content

Function: injectSharedState()

@roomful/angular


@roomful/angular / injectSharedState

injectSharedState<T, TPresence>(key, options): readonly [Signal<T>, SharedStateSetter<T>]

Defined in: angular/src/index.ts:1509

Binds a shared state value to Angular signal semantics.

Must be called in an injection context. Enforces a single shared-state binding per room: a second injectSharedState for the same room must use the same key and compatible options.

T

The shared state value type.

TPresence extends PresenceData = PresenceData

The room presence shape.

string

The logical binding key used to enforce a single shared-state binding per room.

StateOptions<T>

The shared-state configuration.

readonly [Signal<T>, SharedStateSetter<T>]

The current shared state signal and a React-style setter.