Skip to main content

Class: SharedDataBusHost

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

Experimental

A host of data that is stored in a global object shared between CoherentGT views. Data published to the host can be retrieved by instances of SharedDataBusClient on the same or different CoherentGT views. The host also acts as a client for its own data. This API is still under development and should not be used for production code.

Extends​

Implements​

  • SharedDataBusHost

Constructors​

Constructor​

new SharedDataBusHost(sharedGlobalName): SharedDataBusHost

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

Experimental

Creates an instance of SharedDataBusHost.

Parameters​

ParameterTypeDescription
sharedGlobalNamestringThe name of the shared global object that is used to hold the data written by the host. There should be at most one instance of SharedDataBusHost across all CoherentGT views for each unique shared global object. This API is still under development and should not be used for production code.

Returns​

SharedDataBusHost

Overrides​

SharedDataBusClient.constructor

Properties​

_isAlive​

protected readonly _isAlive: Subject<boolean>

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

Experimental

Implementation of​

SharedDataBusHost._isAlive

Inherited from​

SharedDataBusClient._isAlive


data​

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

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

Experimental

Implementation of​

SharedDataBusHost.data

Inherited from​

SharedDataBusClient.data


isAlive​

readonly isAlive: Subscribable<boolean>

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

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.

Implementation of​

SharedDataBusHost.isAlive

Inherited from​

SharedDataBusClient.isAlive


localSubjects​

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

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

Experimental

Implementation of​

SharedDataBusHost.localSubjects

Inherited from​

SharedDataBusClient.localSubjects


sharedGlobalName​

protected readonly sharedGlobalName: string

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

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.

Implementation of​

SharedDataBusHost.sharedGlobalName

Inherited from​

SharedDataBusClient.sharedGlobalName


typedImplementation​

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

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

Experimental

Implementation of​

SharedDataBusHost.typedImplementation

Inherited from​

SharedDataBusClient.typedImplementation

Methods​

createTypedImplementation()​

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

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

Experimental

Creates an object that can access any data item from this host and implements TypedDataBusHost.

Returns​

TypedDataBusHost<Record<string, any>>

An object that can access any data item from this host and implements TypedDataBusHost.

Implementation of​

SharedDataBusHost.createTypedImplementation

Overrides​

SharedDataBusClient.createTypedImplementation


getDataItemEntry()​

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

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

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.

Implementation of​

SharedDataBusClient.getDataItemEntry

Inherited from​

SharedDataBusClient.getDataItemEntry


getDataItemEntryFromLabelEntry()​

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

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

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.

Implementation of​

SharedDataBusHost.getDataItemEntryFromLabelEntry

Inherited from​

SharedDataBusClient.getDataItemEntryFromLabelEntry


getLabelEntry()​

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

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

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.

Implementation of​

SharedDataBusClient.getLabelEntry

Inherited from​

SharedDataBusClient.getLabelEntry


getLocalSubject()​

protected getLocalSubject<R, L>(label, index): DistributedSubject<R[L]>

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

Experimental

Gets the local subject for a data item. If a local subject does not exist for the specified data item, then one will be created.

Type Parameters​

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

Parameters​

ParameterTypeDescription
labelLThe label of the data item for which to get a local subject.
indexnumberThe index of the data item for which to get a local subject.

Returns​

DistributedSubject<R[L]>

The local subject for the specified data item.

Implementation of​

SharedDataBusClient.getLocalSubject

Inherited from​

SharedDataBusClient.getLocalSubject


initSharedGlobal()​

protected initSharedGlobal(): Promise<void>

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

Experimental

Initializes the shared global object to which this host will write data.

Returns​

Promise<void>

Implementation of​

SharedDataBusHost.initSharedGlobal

Overrides​

SharedDataBusClient.initSharedGlobal


of()​

of<R>(): TypedDataBusHost<R>

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

Experimental

Type Parameters​

Type ParameterDefault type
R extends Record<string, any>Record<never, never>

Returns​

TypedDataBusHost<R>

Inherit Doc​

Implementation of​

SharedDataBusHost.of

Overrides​

SharedDataBusClient.of


setSharedData()​

protected setSharedData(data): void

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

Experimental

Sets the shared data object used by this client.

Parameters​

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

Returns​

void

Implementation of​

SharedDataBusHost.setSharedData

Inherited from​

SharedDataBusClient.setSharedData


update()​

update(): void

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

Experimental

Returns​

void

Inherit Doc​

Implementation of​

SharedDataBusHost.update

Overrides​

SharedDataBusClient.update