IFluidContainer Interface

Packages > fluid-framework > IFluidContainer

The IFluidContainer provides an entrypoint into the client side of collaborative Fluid data. It provides access to the data as well as status on the collaboration session.

Signature:

export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> 

Extends: IFluidContainerEvents

Properties

List of properties of this interface
Property Type Description
attachState AttachState The current attachment state of the container. Once a container has been attached, it remains attached. When loading an existing container, it will already be attached.
connected Whether the container is connected to the collaboration session.
connectionState Provides the current connected state of the container
disposed Whether the container is disposed, which permanently disables it.
initialObjects LoadableObjectRecord The collection of data objects and DDSes that were specified by the schema. These data objects and DDSes exist for the lifetime of the container.
isDirty A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service. You should always check the isDirty flag before closing the container or navigating away from the page. Closing the container while isDirty === true may result in the loss of operations that have not yet been acknowledged by the service.A container is considered dirty in the following cases:1. The container has been created in the detached state, and either it has not been attached yet or it is in the process of being attached (container is in attaching state). If container is closed prior to being attached, host may never know if the file was created or not.2. The container was attached, but it has local changes that have not yet been saved to service endpoint. This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the service. In some cases this can be due to lack of network connection. If the network connection is down, it needs to be restored for the pending changes to be acknowledged.

Methods

List of methods of this class
Method Description
attach() A newly created container starts detached from the collaborative service. Calling attach() uploads the new container to the service and connects to the collaborative service.
connect() Attempts to connect the container to the delta stream and process ops
create(objectClass) Create a new data object or DDS of the specified type. In order to share the data object or DDS with other collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your initialObjects.
disconnect() Disconnects the container from the delta stream and stops processing ops
dispose() Dispose of the container instance, permanently disabling it.

Events

attachState

The current attachment state of the container. Once a container has been attached, it remains attached. When loading an existing container, it will already be attached.

Signature:

readonly attachState: AttachState;

connected

Deprecated

Whether the container is connected to the collaboration session.

Signature:

readonly connected: boolean;

connectionState

Provides the current connected state of the container

Signature:

readonly connectionState: ConnectionState;

disposed

Whether the container is disposed, which permanently disables it.

Signature:

readonly disposed: boolean;

initialObjects

The collection of data objects and DDSes that were specified by the schema. These data objects and DDSes exist for the lifetime of the container.

Signature:

readonly initialObjects: LoadableObjectRecord;

isDirty

A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service. You should always check the isDirty flag before closing the container or navigating away from the page. Closing the container while isDirty === true may result in the loss of operations that have not yet been acknowledged by the service.

A container is considered dirty in the following cases:

  1. The container has been created in the detached state, and either it has not been attached yet or it is in the process of being attached (container is in attaching state). If container is closed prior to being attached, host may never know if the file was created or not.

  2. The container was attached, but it has local changes that have not yet been saved to service endpoint. This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the service. In some cases this can be due to lack of network connection. If the network connection is down, it needs to be restored for the pending changes to be acknowledged.

Signature:

readonly isDirty: boolean;

Methods

attach

A newly created container starts detached from the collaborative service. Calling attach() uploads the new container to the service and connects to the collaborative service.

Signature:

attach(): Promise<string>;

Returns:

A promise which resolves when the attach is complete, with the string identifier of the container.

connect

Attempts to connect the container to the delta stream and process ops

Signature:

connect?(): void;

Returns:

create

Create a new data object or DDS of the specified type. In order to share the data object or DDS with other collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your initialObjects.

Signature:

create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;

Parameters

List of parameters
Parameter Type Description
objectClass LoadableObjectClass The class of data object or DDS to create

Returns:

disconnect

Disconnects the container from the delta stream and stops processing ops

Signature:

disconnect?(): void;

Returns:

dispose

Dispose of the container instance, permanently disabling it.

Signature:

dispose(): void;

Returns: