PureDataObject Class
This is a bare-bones base class that does basic setup and enables for factory on an initialize call. You probably don't want to inherit from this data store directly unless you are creating another base data store class
Signature
export declare abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes> extends EventForwarder<I["Events"] & IEvent> implements IFluidLoadable, IFluidRouter, IProvideFluidHandle
Extends: EventForwarder<I["Events"] & IEvent
Implements: IFluidLoadable, IFluidRouter, IProvideFluidHandle
Type Parameters
| Parameter | Constraint | Default | Description |
|---|---|---|---|
| I | DataObjectTypes | DataObjectTypes | The optional input types used to strongly type the data object |
Constructors
| Constructor | Description |
|---|---|
| (constructor)(props) | Constructs a new instance of the PureDataObject class |
Static Methods
| Method | Return Type | Description |
|---|---|---|
| getDataObject(runtime) | Promise<PureDataObject<DataObjectTypes>> |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| context | IFluidDataStoreContext | This context is used to talk up to the ContainerRuntime | |
| disposed | boolean | ||
| handle | IFluidHandle<this> | Handle to a data store | |
| id | string | ||
| IFluidHandle | IFluidHandle<this> | ||
| IFluidLoadable | this | ||
| IFluidRouter | this | ||
| initializeP | Promise<void> | undefined | ||
| initProps | optional | I["InitialState"] | |
| providers | AsyncFluidObjectProvider<I["OptionalProviders"]> | Providers are FluidObject keyed objects that provide back a promise to the corresponding FluidObject or undefined. Providers injected/provided by the Container and/or HostingApplication To define providers set FluidObject interfaces in the OptionalProviders generic type for your data store | |
| runtime | IFluidDataStoreRuntime | This is your FluidDataStoreRuntime object |
Methods
| Method | Return Type | Description |
|---|---|---|
| dispose() | void | Called when the host container closes and disposes itself |
| finishInitialization(existing) | Promise<void> | Call this API to ensure PureDataObject is fully initialized. Initialization happens on demand, only on as-needed bases. In most cases you should allow factory/object to decide when to finish initialization. But if you are supplying your own implementation of DataStoreRuntime factory and overriding some methods and need a fully initialized object, then you can call this API to ensure object is fully initialized. |
| getFluidObjectFromDirectory(key, directory, getObjectFromDirectory) | Promise<T | undefined> | Retrieve Fluid object using the handle get |
| getService(id) | Promise<T> | Gets the service at a given id. |
| hasInitialized() | Promise<void> | Called every time the data store is initialized after create or existing. |
| initializeInternal(existing) | Promise<void> | Internal initialize implementation. Overwriting this will change the flow of the PureDataObject and should generally not be done. Calls initializingFirstTime, initializingFromExisting, and hasInitialized. Caller is responsible for ensuring this is only invoked once. |
| initializingFirstTime(props) | Promise<void> | Called the first time the data store is initialized (new creations with a new data store runtime) |
| initializingFromExisting() | Promise<void> | Called every time but the first time the data store is initialized (creations with an existing data store runtime) |
| preInitialize() | Promise<void> | Called every time the data store is initialized, before initializingFirstTime or initializingFromExisting is called. |
| request(req) | Promise<IResponse> | Return this object if someone requests it directly We will return this object in two scenarios: 1. the request url is a "/" 2. the request url is empty |
Constructor Details
(constructor)
Constructs a new instance of the PureDataObject class
Signature
constructor(props: IDataObjectProps<I>);
Parameters
| Parameter | Type | Description |
|---|---|---|
| props | IDataObjectProps<I> |
Property Details
context
This context is used to talk up to the ContainerRuntime
Signature
protected readonly context: IFluidDataStoreContext;
Type: IFluidDataStoreContext
disposed
Signature
get disposed(): boolean;
Type: boolean
handle
Handle to a data store
Signature
get handle(): IFluidHandle<this>;
Type: IFluidHandle<this>
id
Signature
get id(): string;
Type: string