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.

This API is provided as a beta preview and may change without notice.

To use, import via @fluidframework/presence/beta.

For more information about our API support guarantees, see here.

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 StatesWorkspaceSchema, TManagerConstraints = unknown>

Type Parameters

ParameterConstraintDefaultDescription
TSchemaStatesWorkspaceSchema
TManagerConstraintsunknown

Properties

PropertyAlertsModifiersTypeDescription
controlsBetareadonlyBroadcastControlsDefault controls for management of broadcast updates.
presenceBetareadonlyPresenceContaining Presence
statesBetareadonlyStatesWorkspaceEntries<TSchema>Registry of State objects.

Methods

MethodAlertsReturn TypeDescription
add(key, manager)Betaasserts 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.

This API is provided as a beta preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

readonly controls: BroadcastControls;

Type: BroadcastControls

presence

Containing Presence

This API is provided as a beta preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

readonly presence: Presence;

Type: Presence

states

Registry of State objects.

This API is provided as a beta preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

readonly states: StatesWorkspaceEntries<TSchema>;

Type: StatesWorkspaceEntries<TSchema>

Method Details

add

Registers a new State object with the StatesWorkspace.

This API is provided as a beta preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

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

Parameters

ParameterTypeDescription
keyTKeynew unique key for the State object within the workspace
managerInternalTypes.ManagerFactory<TKey, TValue, TManager>factory for creating a State object

Returns

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