Skip to main content
Version: v1

IChannelFactory Interface

Definitions of a channel factory. Factories follow a common model but enable custom behavior.

Signature​

export interface IChannelFactory

Properties​

PropertyTypeDescription
attributesIChannelAttributesAttributes of the channel.
typestringString representing the type of the factory.

Methods​

MethodReturn TypeDescription
create(runtime, id)IChannelCreates a local version of the channel. Calling attach on the object later will insert it into the object stream.
load(runtime, id, services, channelAttributes)Promise<IChannel>Loads the given channel. This call is only ever invoked internally as the only thing that is ever directly loaded is the document itself. Load will then only be called on documents that were created and added to a channel.

Property Details​

attributes​

Attributes of the channel.

Signature​

readonly attributes: IChannelAttributes;

Type: IChannelAttributes

type​

String representing the type of the factory.

Signature​

readonly type: string;

Type: string

Method Details​

create​

Creates a local version of the channel. Calling attach on the object later will insert it into the object stream.

Signature​

create(runtime: IFluidDataStoreRuntime, id: string): IChannel;

Parameters​

ParameterTypeDescription
runtimeIFluidDataStoreRuntimeThe runtime the new object will be associated with
idstringThe unique ID of the new object

Returns​

The newly created object.

Return type: IChannel

load​

Loads the given channel. This call is only ever invoked internally as the only thing that is ever directly loaded is the document itself. Load will then only be called on documents that were created and added to a channel.

Signature​

load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, channelAttributes: Readonly<IChannelAttributes>): Promise<IChannel>;

Parameters​

ParameterTypeDescription
runtimeIFluidDataStoreRuntimeData store runtime containing state/info/helper methods about the data store.
idstringID of the channel.
servicesIChannelServicesServices to read objects at a given path using the delta connection.
channelAttributesReadonly<IChannelAttributes>The attributes for the the channel to be loaded.

Returns​

The loaded object

Return type: Promise<IChannel>