Skip to main content

IWatchedValue<T>

Interface
Types Module: Broker

Type parameters

Name
T

Methods

setValue

Set value for the watched value

Signature

setValue(value: T, forceUpdate?: boolean) => void

Parameters

NameTypeDescription
valueTvalue to set
forceUpdate?booleanforce an update

Returns

void

Overrides

IObservableValue.setValue


subscribe

Subscribe to watched value changes

Signature

subscribe(callback: WatchedValueCallback<T>, options?: WatchedValueSubscribeOptions) => void

Parameters

NameTypeDescription
callbackWatchedValueCallback<T>callback to be evoked when change occurs
options?WatchedValueSubscribeOptionswatch subscriber options

Returns

void

Overrides

IObservableValue.subscribe


unsubscribe

Unsubscribe to watched value changes

Signature

unsubscribe(callback?: WatchedValueCallback<T>) => void

Parameters

NameTypeDescription
callback?WatchedValueCallback<T>callback to remove

Returns

void

Overrides

IObservableValue.unsubscribe


value

Value

Signature

value() => T

Returns

T


when

A simplified version of subscription, with promise-like interface, generally for using with boolean-valued watched values

Signature

when(callback: WatchedValueCallback<T>) => void

Parameters

NameTypeDescription
callbackWatchedValueCallback<T>a function to be called when the value became true. once and callWithLast are implicitly set to true.

Returns

void