SharedCell Class
Packages > @fluidframework/cell > SharedCell
Implementation of a cell shared object
Signature:
export declare class SharedCell<T extends Serializable = any> extends SharedObject<ISharedCellEvents<T>> implements ISharedCell<T>
Extends: SharedObject<ISharedCellEvents<T>>
Implements: ISharedCell<T>
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(id, runtime, attributes) | Constructs a new shared cell. If the object is non-local an id and service interfaces will be provided |
Methods
Method | Modifiers | Description |
---|---|---|
create(runtime, id) | static |
Create a new shared cell |
delete() | Delete the value from the cell. | |
empty() | Checks whether cell is empty or not. | |
get() | Retrieves the cell value. | |
getFactory() | static |
Get a factory for SharedCell to register with the data store. |
initializeLocalCore() | Initialize a local instance of cell | |
loadCore(branchId, storage) | Load cell from snapshot | |
onDisconnect() | Call back on disconnect | |
processCore(message, local, localOpMetadata) | Process a cell operation | |
registerCore() | Process the cell value on register | |
set(value) | Sets the cell value. | |
snapshot() | Create a snapshot for the cell |
Constructors
SharedCell.(constructor)
Constructs a new shared cell. If the object is non-local an id and service interfaces will be provided
Signature:
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
Parameters
Parameter | Type | Description |
---|---|---|
id | string | optional name of the shared map |
runtime | IFluidDataStoreRuntime | data store runtime the shared map belongs to |
attributes | IChannelAttributes |
Methods
create
Create a new shared cell
Signature:
static create(runtime: IFluidDataStoreRuntime, id?: string): SharedCell<any>;
Parameters
Parameter | Type | Description |
---|---|---|
runtime | IFluidDataStoreRuntime | data store runtime the new shared map belongs to |
id | string | optional name of the shared map |
Returns:
SharedCell<any>
newly create shared map (but not attached yet)
delete
Delete the value from the cell.
Signature:
delete(): void;
Returns:
void
empty
Checks whether cell is empty or not.
Signature:
empty(): boolean;
Returns:
boolean
true
if the value of cell isundefined
,false
otherwise
get
Retrieves the cell value.
Signature:
get(): T | undefined;
Returns:
T | undefined
- the value of the cell
getFactory
Get a factory for SharedCell to register with the data store.
Signature:
static getFactory(): IChannelFactory;
Returns:
a factory that creates and load SharedCell
initializeLocalCore
Initialize a local instance of cell
Signature:
protected initializeLocalCore(): void;
Returns:
void
loadCore
Load cell from snapshot
Signature:
protected loadCore(branchId: string | undefined, storage: IChannelStorageService): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
branchId | string | undefined | Not used |
storage | IChannelStorageService | the storage to get the snapshot from |
Returns:
Promise<void>
- promise that resolved when the load is completed
onDisconnect
Call back on disconnect
Signature:
protected onDisconnect(): void;
Returns:
void
processCore
Process a cell operation
Signature:
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
Parameters
Parameter | Type | Description |
---|---|---|
message | ISequencedDocumentMessage | the message to prepare |
local | boolean | whether the message was sent by the local client |
localOpMetadata | unknown | For local client messages, this is the metadata that was submitted with the message. For messages from a remote client, this will be undefined. |
Returns:
void
registerCore
Process the cell value on register
Signature:
protected registerCore(): void;
Returns:
void
set
Sets the cell value.
Signature:
set(value: T): void;
Parameters
Parameter | Type | Description |
---|---|---|
value | T | a JSON-able or SharedObject value to set the cell to |
Returns:
void
snapshot
Create a snapshot for the cell
Signature:
snapshot(): ITree;
Returns:
the snapshot of the current state of the cell