Skip to main content

Interface: TypedDataBusHost<R, I>

Defined in: src/sdk/data/DataBus.ts:69

Experimental

A provider of subscribable DataItems that also supports publishing changes to the same data items. Each data item is accessed using a combination of a string label and a numeric index. The data item labels available from the provider are defined by its record type parameter.

Extends

Type Parameters

Type ParameterDefault typeDescription
R extends Record<string, any>-The record describing the data items available from the host. The name of each property in the record defines one label that can be used to access a data item, and the type of the property defines the value type of data items accessed using the label (under any index).
I extends numbernumberThe indexes for which data items are available from the host.

Methods

defineEquality()

defineEquality<L>(label, equalityFunc): void

Defined in: src/sdk/data/DataBus.ts:81

Experimental

Defines equality semantics for data item values published to a given label. The specified equality semantics will be used to determine whether to notify subscribers when an update to the data item is published (subscribers are notified if and only if either the new data item value or status is not equal to the old data item value or status, respectively).

Type Parameters

Type Parameter
L extends string

Parameters

ParameterTypeDescription
labelLThe label for which to define data item value equality semantics.
equalityFunc(a, b) => boolean | undefinedA function that implements the desired equality semantics by returning whether two data item values are equal. If not defined, then default equality semantics will be used, which state that two values a and b are equal if and only if the strict equality operator (===) evaluates to true for a and b, or both a and b are the numeric value NaN.

Returns

void


getSubscribable()

getSubscribable<L>(label, index): Subscribable<Readonly<DataItem<R[L]>>>

Defined in: src/sdk/data/DataBus.ts:38

Experimental

Gets a subscribable for a data item.

Type Parameters

Type ParameterDescription
L extends stringThe label of the data item to get.

Parameters

ParameterTypeDescription
labelLThe label of the data item to get.
indexIThe index of the data item to get.

Returns

Subscribable<Readonly<DataItem<R[L]>>>

A subscribable for the requested data item.

Inherited from

TypedDataBusClient.getSubscribable


publish()

Call Signature

publish<L>(label, index, value): void

Defined in: src/sdk/data/DataBus.ts:91

Experimental

Publishes a value update to this data bus. The updated data item will retain its current status. If the data item's current status is EmptyValue, then the value update will be ignored.

Type Parameters
Type ParameterDescription
L extends stringThe label of the data item to publish to.
Parameters
ParameterTypeDescription
labelLThe label of the data item to publish to.
indexIThe index of the data item to publish to.
valueR[L]The value to publish.
Returns

void

Call Signature

publish<L>(label, index, value, status): void

Defined in: src/sdk/data/DataBus.ts:100

Experimental

Publishes a no-value update to this data bus.

Type Parameters
Type ParameterDescription
L extends stringThe label of the data item to publish to.
Parameters
ParameterTypeDescription
labelLThe label of the data item to publish to.
indexIThe index of the data item to publish to.
valueundefinedThe value to publish, which must be undefined.
statusEmptyValueA status to publish along with the value, which must be EmptyValue.
Returns

void

Call Signature

publish<L>(label, index, value, status): void

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

Experimental

Publishes a value and status update to this data bus.

Type Parameters
Type ParameterDescription
L extends stringThe label of the data item to publish to.
Parameters
ParameterTypeDescription
labelLThe label of the data item to publish to.
indexIThe index of the data item to publish to.
valueR[L]The value to publish.
statusNormal | Failed | NoComputedValue | TestingThe status to publish.
Returns

void

Call Signature

publish<L, S>(label, index, value, status): void

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

Experimental

Publishes a value and status update to this data bus.

Type Parameters
Type ParameterDescription
L extends stringThe label of the data item to publish to.
S extends DataItemStatusThe status to publish.
Parameters
ParameterTypeDescription
labelLThe label of the data item to publish to.
indexIThe index of the data item to publish to.
valueS extends EmptyValue ? undefined : R[L]The value to publish.
statusSThe status to publish.
Returns

void