Table of Contents

Class DebounceTimeOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

Implements the DebounceTime operator. Mirrors rxjs's debounceTime.

public static class DebounceTimeOperator
Inheritance
System.Object
DebounceTimeOperator

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

source Observable<T>

The source observable to debounce.

dueTime TimeSpan

The quiet period required, after the most recent value, before it is let through.

scheduler IScheduler

The scheduler used to run the debounce timer. Defaults to Instance when null.

Returns

Observable<T>

An observable that emits each value from source only after dueTime has elapsed without a newer value arriving.

Type Parameters

T

The 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.