Extensions

Press shift + S to search API reference.

Model

AbstractModelWithAsyncData

View source

Abstract superclass for all Blocks SDK models that need to fetch async data.

Members

class AbstractModelWithAsyncData extends AbstractModel<DataType, WatchableKey>
readonly idstring

The ID for this model.

readonly isDataLoadedboolean
readonly isDeletedboolean
loadDataAsync
function () => Promise<void>

Will cause all the async data to be fetched and retained. Every call to loadDataAsync should have a matching call to unloadData.

Returns a Promise that will resolve once the data is loaded.

toString
function () => string

A string representation of the model for use in debugging.

unloadData
function () => void
unwatch
function (keys: WatchableKey | ReadonlyArray<WatchableKey>, callback: FlowAnyFunction, context?: FlowAnyObject | null) => Array<WatchableKey>

Unwatching a key that needs to load data asynchronously will automatically cause the data to be released. Once the data is available, the callback will be called.

watch
function (keys: WatchableKey | ReadonlyArray<WatchableKey>, callback: FlowAnyFunction, context?: FlowAnyObject | null) => Array<WatchableKey>

Watching a key that needs to load data asynchronously will automatically cause the data to be fetched. Once the data is available, the callback will be called.