IDynamicDataCallables interface

Interface for components to implement in order to be dynamic data sources. This can be implemented as an object with state, or a set of loose functions that returns the data.

Methods

allowedEvents()

Returns list of allowed events on the dynamic data source.

When this function returns a non-empty result, then source must define 'sendEvent' api.

If this api is not defined or returns an empty array, then no consumer will be able to talk to this source.

getAnnotatedPropertyValue(propertyId)

Given a property id, returns its annotated value. If the source doesn't supply the annotated value, then it falls back to whatever 'getPropertyValue' returns as the sample value and metadata would be undefined.

getPropertyDefinitions()

Returns all the property definitions that the DataSource will provide.

getPropertyValue(propertyId)

Given a property id, returns the value of the property.

sendEvent(eventName, data)

If defined, enables the consumer to send data to the associated dynamic data source. Then source can act accordingly.

Invoking this api throws an error when the passed in 'eventName' is not one of the allowed events on the source.

Method Details

allowedEvents()

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Returns list of allowed events on the dynamic data source.

When this function returns a non-empty result, then source must define 'sendEvent' api.

If this api is not defined or returns an empty array, then no consumer will be able to talk to this source.

allowedEvents?(): ReadonlyArray<IDynamicDataEventDefinition>;

Returns

getAnnotatedPropertyValue(propertyId)

Given a property id, returns its annotated value. If the source doesn't supply the annotated value, then it falls back to whatever 'getPropertyValue' returns as the sample value and metadata would be undefined.

getAnnotatedPropertyValue?(propertyId: string): IDynamicDataAnnotatedPropertyValue | undefined;

Parameters

propertyId

string

One of the property ids exposed from the dynamic data source.

Returns

getPropertyDefinitions()

Returns all the property definitions that the DataSource will provide.

getPropertyDefinitions(): ReadonlyArray<IDynamicDataPropertyDefinition>;

Returns

getPropertyValue(propertyId)

Given a property id, returns the value of the property.

getPropertyValue(propertyId: string): any;

Parameters

propertyId

string

Returns

any

Remarks

It is assumed that when this function returns an array, it is homogeneous.

sendEvent(eventName, data)

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

If defined, enables the consumer to send data to the associated dynamic data source. Then source can act accordingly.

Invoking this api throws an error when the passed in 'eventName' is not one of the allowed events on the source.

sendEvent?(eventName: string, data: any): void;

Parameters

eventName

string

A case-sensitive string representing the name of the event.

data

any

Data to be sent to the dynamic data source.

Returns

void