Class DebounceTimeOperator
Implements the DebounceTime operator. Mirrors rxjs's debounceTime.
public static class DebounceTimeOperator
- Inheritance
-
System.ObjectDebounceTimeOperator
Methods
DebounceTime<T>(Observable<T>, TimeSpan, IScheduler?)
Emits the most recent value from source only after dueTime has passed
without a further emission, dropping every value superseded within that quiet period.
public static Observable<T> DebounceTime<T>(this Observable<T> source, TimeSpan dueTime, IScheduler? scheduler = null)
Parameters
sourceObservable<T>The source observable to debounce.
dueTimeTimeSpanThe quiet period required, after the most recent value, before it is let through.
schedulerISchedulerThe scheduler used to run the debounce timer. Defaults to Instance when null.
Returns
- Observable<T>
An observable that emits each value from
sourceonly afterdueTimehas elapsed without a newer value arriving.
Type Parameters
TThe type of the values being debounced.
Remarks
Simpler than rxjs's own implementation (which re-checks elapsed wall-clock time to avoid an unnecessary
reschedule): here every new value just cancels and restarts the pending timer, which is functionally
equivalent for a scheduler backed by real timers. If source completes while a value is
still pending, that value is emitted immediately before completion is forwarded. If source
errors, the pending value is discarded and the error is forwarded immediately, without waiting out the
remainder of dueTime.