interval<T> method
void
interval<T>(})
Implementation
void interval<T>(
RxVar<T> rx,
void Function(T) worker, {
Duration duration = const Duration(milliseconds: 500),
bool leading = true,
}) {
// rxdart's debounceTime emits the *last* event after the duration has passed since the last event
Stream<T> s = rx.stream.debounceTime(duration);
// If leading is true, emit first value immediately and then throttle
if (leading && rx.hasValue) {
worker(rx.value);
}
addWorker(s.skip(1).listen(worker));
}