PodWorkers<T> extension
Extension methods for WhalePod to provide advanced reactive programming patterns like debounce, interval, once, and ever.
- on
-
- WhalePod<
T>
- WhalePod<
Methods
-
debounce(
Duration duration, void callback(T value)) → VoidCallback -
Available on WhalePod<
CallsT> , provided by the PodWorkers extensioncallbackwhen the value changes, but only afterdurationhas passed without any further changes. Extremely useful for search fields to avoid spamming an API. -
ever(
void callback(T value)) → VoidCallback -
Available on WhalePod<
CallsT> , provided by the PodWorkers extensioncallbackevery time the value changes. Returns a function that cancels the listener. -
interval(
Duration duration, void callback(T value)) → VoidCallback -
Available on WhalePod<
CallsT> , provided by the PodWorkers extensioncallbackat most once everydurationupon changes. Useful to restrict the firing rate of rapid events (e.g. scroll metrics). -
once(
void callback(T value)) → VoidCallback -
Available on WhalePod<
CallsT> , provided by the PodWorkers extensioncallbackonly once, the next time the value changes.