PodWorkers<T> extension

Extension methods for WhalePod to provide advanced reactive programming patterns like debounce, interval, once, and ever.

on

Methods

debounce(Duration duration, void callback(T value)) VoidCallback

Available on WhalePod<T>, provided by the PodWorkers extension

Calls callback when the value changes, but only after duration has passed without any further changes. Extremely useful for search fields to avoid spamming an API.
ever(void callback(T value)) VoidCallback

Available on WhalePod<T>, provided by the PodWorkers extension

Calls callback every time the value changes. Returns a function that cancels the listener.
interval(Duration duration, void callback(T value)) VoidCallback

Available on WhalePod<T>, provided by the PodWorkers extension

Calls callback at most once every duration upon changes. Useful to restrict the firing rate of rapid events (e.g. scroll metrics).
once(void callback(T value)) VoidCallback

Available on WhalePod<T>, provided by the PodWorkers extension

Calls callback only once, the next time the value changes.