type ObservableObject.AsyncObserver
Type definition for an async observer callback or configuration object.
type AsyncObserver<TArgs extends any[]> =
| ((...args: TArgs) => Promise<void> | void)
| {
update: (...args: TArgs) => Promise<void> | void;
debounce?: number;
throttle?: number;
};
Notes
- If a function is provided, the function is called asynchronously, with the current values as (multiple) arguments.
- If an object is provided, the
updatefunction is called with current values. The other properties determine optional debounce/throttle timing.
Instance members
update
Function called when observed values change.debounce
Debounce time in ms - resets timer on each change, only last update runs.throttle
Throttle time in ms - minimum time between updates.
Related
class ObservableObject
The base class of all observable objects, which can be placed into a tree structure to enable event handling and data binding.
