Function: useSharedState()
@roomful/vue / useSharedState
Function: useSharedState()
Section titled “Function: useSharedState()”useSharedState<
T,TPresence>(key,options): readonly [Readonly<ShallowRef<T>>,SharedStateSetter<T>]
Defined in: vue/src/index.ts:450
Binds a shared state value to Vue refs.
Type Parameters
Section titled “Type Parameters”T
The shared state value type.
TPresence
Section titled “TPresence”TPresence extends PresenceData = PresenceData
The room presence shape.
Parameters
Section titled “Parameters”string
The logical binding key used to enforce a single shared-state binding per room.
options
Section titled “options”StateOptions<T>
The shared-state configuration.
Returns
Section titled “Returns”readonly [Readonly<ShallowRef<T>>, SharedStateSetter<T>]
A readonly ref for the value and a setter function.