Skip to main content

StatesWorkspace Interface

StatesWorkspace maintains a registry of State objects that all share and provide access to presence state values across client members in a session.

State objects offer variations on how to manage states, but all share same principle that each client's state is independent and may only be updated by originating client.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature

/** @sealed */
export interface StatesWorkspace<TSchema extends Partial<StatesWorkspaceSchema<TSchemaKeys>>, TManagerConstraints = unknown, TSchemaKeys extends string & keyof TSchema = string & keyof TSchema>

Type Parameters

ParameterConstraintDefaultDescription
TSchemaPartial<StatesWorkspaceSchema<TSchemaKeys>>
TManagerConstraintsunknown
TSchemaKeysstring & keyof TSchemastring & keyof TSchema

Properties

PropertyModifiersTypeDescription
controlsreadonlyBroadcastControlsDefault controls for management of broadcast updates.
presencereadonlyPresenceContaining Presence
statesreadonlyStatesWorkspaceEntries<TSchema, TSchemaKeys>Registry of State objects.

Methods

MethodReturn TypeDescription
add(key, configuration)asserts this is StatesWorkspace<TSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>, TManagerConstraints>Registers a new State object with the StatesWorkspace.

Property Details

controls

Default controls for management of broadcast updates.

Signature

readonly controls: BroadcastControls;

Type: BroadcastControls

presence

Containing Presence

Signature

readonly presence: Presence;

Type: Presence

states

Registry of State objects.

Signature

readonly states: StatesWorkspaceEntries<TSchema, TSchemaKeys>;

Type: StatesWorkspaceEntries<TSchema, TSchemaKeys>

Method Details

add

Registers a new State object with the StatesWorkspace.

Signature

add<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<unknown>, TManager extends TManagerConstraints>(key: TKey, configuration: InternalTypes.ManagerFactory<TKey, TValue, TManager>): asserts this is StatesWorkspace<TSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>, TManagerConstraints>;
Type Parameters
ParameterConstraintDescription
TKeystring
TValueInternalTypes.ValueDirectoryOrState<unknown>
TManagerTManagerConstraints

Parameters

ParameterTypeDescription
keyTKeynew unique key for the State object within the workspace
configurationInternalTypes.ManagerFactory<TKey, TValue, TManager>factory/settings for creating a State object. Use StateFactory to create.

Returns

Return type: asserts this is StatesWorkspace<TSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>, TManagerConstraints>