Skip to main content
Version: latest

IWatchedValueReadonly<T>

Interface
Types Module: Broker

Type parameters

Name
T

Methods

subscribe

Subscribe to watched value changes

Signature

subscribe(callback: Function, options?: WatchedValueSubscribeOptions) => void

Parameters

NameTypeDescription
callback(value: T) => voidcallback to be evoked when change occurs
options?WatchedValueSubscribeOptionswatch subscriber options

Returns

void

Overrides

IObservableValueReadOnly.subscribe


unsubscribe

Unsubscribe to watched value changes

Signature

unsubscribe(callback?: Function) => void

Parameters

NameTypeDescription
callback?(value: T) => voidcallback to remove

Returns

void

Overrides

IObservableValueReadOnly.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