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

Parameter Constraint Default Description
TSchema StatesWorkspaceSchema
TManagerConstraints unknown

Properties

Property Alerts Modifiers Type Description
controls Beta readonly BroadcastControls Default controls for management of broadcast updates.
presence Beta readonly Presence Containing Presence
states Beta readonly StatesWorkspaceEntries<TSchema> Registry of State objects.

Methods

Method Alerts Return Type Description
add(key, manager) Beta 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.

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

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
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.

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
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.

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
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.

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
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
Parameter Constraint Description
TKey string
TValue InternalTypes.ValueDirectoryOrState<any>
TManager TManagerConstraints

Parameters

Parameter Type Description
key TKey new unique key for the State object within the workspace
manager InternalTypes.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>