Skip to main content

PresenceStates Interface

PresenceStates maintains a registry of Value Managers that all share and provide access to presence state values across client members in a session.

Value Managers 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 an alpha preview and may change without notice.

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

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

Signature

/** @sealed */
export interface PresenceStates<TSchema extends PresenceStatesSchema, TManagerConstraints = unknown>

Type Parameters

Parameter Constraint Default Description
TSchema PresenceStatesSchema
TManagerConstraints unknown

Properties

Property Alerts Modifiers Type Description
props Alpha readonly PresenceStatesEntries<TSchema> Registry of Value Managers.

Methods

Method Alerts Return Type Description
add(key, manager) Alpha asserts this is PresenceStates<TSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>, TManagerConstraints> Registers a new Value Manager with the PresenceStates.

Property Details

props

Registry of Value Managers.

This API is provided as an alpha preview and may change without notice.

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

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

Signature

readonly props: PresenceStatesEntries<TSchema>;

Type: PresenceStatesEntries<TSchema>

Method Details

add

Registers a new Value Manager with the PresenceStates.

This API is provided as an alpha preview and may change without notice.

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

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 PresenceStates<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 Value Manager
manager InternalTypes.ManagerFactory<TKey, TValue, TManager> factory for creating a Value Manager

Returns

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