Skip to main content

Class: SharedDataBusClient

Defined in: src/sdk/data/SharedDataBus.ts:109

Experimental

A provider of data that is stored in a global object shared between CoherentGT views. The client requires a corresponding SharedDataBusHost to function properly. This API is still under development and should not be used for production code.

Extended by

Implements

Constructors

Constructor

new SharedDataBusClient(sharedGlobalName): SharedDataBusClient

Defined in: src/sdk/data/SharedDataBus.ts:128

Experimental

Creates an instance of SharedDataBusClient.

Parameters

ParameterTypeDescription
sharedGlobalNamestringThe name of the shared global object that is used to hold the data provided by the client. This API is still under development and should not be used for production code.

Returns

SharedDataBusClient

Properties

_isAlive

protected readonly _isAlive: Subject<boolean>

Defined in: src/sdk/data/SharedDataBus.ts:114

Experimental


data

protected data: Map<string, LabelEntry<any>>

Defined in: src/sdk/data/SharedDataBus.ts:111

Experimental


isAlive

readonly isAlive: Subscribable<boolean>

Defined in: src/sdk/data/SharedDataBus.ts:119

Experimental

Signals if the data bus host is alive and available for writing and reading. This API is still under development and should not be used for production code.


localSubjects

protected readonly localSubjects: Map<string, Map<number, DistributedSubject<any>>>

Defined in: src/sdk/data/SharedDataBus.ts:112

Experimental


sharedGlobalName

protected readonly sharedGlobalName: string

Defined in: src/sdk/data/SharedDataBus.ts:128

Experimental

The name of the shared global object that is used to hold the data provided by the client. This API is still under development and should not be used for production code.


typedImplementation

protected readonly typedImplementation: TypedDataBusClient<Record<string, any>, number>

Defined in: src/sdk/data/SharedDataBus.ts:121

Experimental

Methods

createTypedImplementation()

protected createTypedImplementation(): TypedDataBusClient<Record<string, any>>

Defined in: src/sdk/data/SharedDataBus.ts:194

Experimental

Creates an object that can access any data item from this client and implements TypedDataBusClient.

Returns

TypedDataBusClient<Record<string, any>>

An object that can access any data item from this client and implements TypedDataBusClient.


getDataItemEntry()

protected getDataItemEntry<R, L>(label, index): DataItemEntry<R[L]>

Defined in: src/sdk/data/SharedDataBus.ts:274

Experimental

Gets the entry for a data item from the shared storage.

Type Parameters

Type ParameterDescription
R extends Record<string, any>A record describing the data item entry to get. The record should contain a property whose name is equal to the label of the data item entry, and the type of the property defines the value type of the data item entry.
L extends stringThe label of the data item entry to get.

Parameters

ParameterTypeDescription
labelLThe label of the data item entry to get.
indexnumberThe index of the data item entry to get.

Returns

DataItemEntry<R[L]>

The requested data item entry.


getDataItemEntryFromLabelEntry()

protected getDataItemEntryFromLabelEntry<T>(labelEntry, index): DataItemEntry<T>

Defined in: src/sdk/data/SharedDataBus.ts:249

Experimental

Gets the entry for a data item from a label entry.

Type Parameters

Type ParameterDescription
TThe type of the data item's value.

Parameters

ParameterTypeDescription
labelEntryLabelEntry<T>The label entry from which to get the data item entry.
indexnumberThe index of the data item entry to get.

Returns

DataItemEntry<T>

The requested data item entry.


getLabelEntry()

protected getLabelEntry<R, L>(label): LabelEntry<R[L]>

Defined in: src/sdk/data/SharedDataBus.ts:229

Experimental

Gets the entry for a data item label from the shared storage.

Type Parameters

Type ParameterDescription
R extends Record<string, any>A record describing the data item label entry to get. The record should contain a property whose name is equal to the label, and the type of the property defines the value type of the label's data items.
L extends stringThe label for which to get an entry.

Parameters

ParameterTypeDescription
labelLThe label for which to get an entry.

Returns

LabelEntry<R[L]>

The requested data item label entry.


initSharedGlobal()

protected initSharedGlobal(): Promise<void>

Defined in: src/sdk/data/SharedDataBus.ts:155

Experimental

Initializes this client from its associated shared global object.

Returns

Promise<void>


of()

of<R>(): TypedDataBusClient<R>

Defined in: src/sdk/data/SharedDataBus.ts:217

Experimental

Retrieves a typed data bus client that provides data items described by a record type.

Type Parameters

Type ParameterDefault typeDescription
R extends Record<string, any>Record<never, never>A record describing the data items available from the typed client to return. The name of each property in the record defines one label that can be used to retrieve a data item, and the type of the property defines the value type of data items retrieved using the label (under any index).

Returns

TypedDataBusClient<R>

A typed data bus client that provides data items described by the specified record type.

Implementation of

DataBusClient.of


setSharedData()

protected setSharedData(data): void

Defined in: src/sdk/data/SharedDataBus.ts:180

Experimental

Sets the shared data object used by this client.

Parameters

ParameterTypeDescription
dataMap<string, LabelEntry<any>>The shared data object to set.

Returns

void


update()

update(): void

Defined in: src/sdk/data/SharedDataBus.ts:282

Experimental

Updates the data bus to notify subscribers of updated data items. This API is still under development and should not be used for production code.

Returns

void