1 import { MonoTypeOperatorFunction, SchedulerLike } from '../types';
3 * Emits a value from the source Observable only after a particular time span
4 * has passed without another source emission.
6 * <span class="informal">It's like {@link delay}, but passes only the most
7 * recent value from each burst of emissions.</span>
9 * ![](debounceTime.png)
11 * `debounceTime` delays values emitted by the source Observable, but drops
12 * previous pending delayed emissions if a new value arrives on the source
13 * Observable. This operator keeps track of the most recent value from the
14 * source Observable, and emits that only when `dueTime` enough time has passed
15 * without any other value appearing on the source Observable. If a new value
16 * appears before `dueTime` silence occurs, the previous value will be dropped
17 * and will not be emitted on the output Observable.
19 * This is a rate-limiting operator, because it is impossible for more than one
20 * value to be emitted in any time window of duration `dueTime`, but it is also
21 * a delay-like operator since output emissions do not occur at the same time as
22 * they did on the source Observable. Optionally takes a {@link SchedulerLike} for
26 * Emit the most recent click after a burst of clicks
28 * import { fromEvent } from 'rxjs';
29 * import { debounceTime } from 'rxjs/operators';
31 * const clicks = fromEvent(document, 'click');
32 * const result = clicks.pipe(debounceTime(1000));
33 * result.subscribe(x => console.log(x));
36 * @see {@link auditTime}
37 * @see {@link debounce}
39 * @see {@link sampleTime}
40 * @see {@link throttleTime}
42 * @param {number} dueTime The timeout duration in milliseconds (or the time
43 * unit determined internally by the optional `scheduler`) for the window of
44 * time required to wait for emission silence before emitting the most recent
46 * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for
47 * managing the timers that handle the timeout for each value.
48 * @return {Observable} An Observable that delays the emissions of the source
49 * Observable by the specified `dueTime`, and may drop some values if they occur
51 * @method debounceTime
54 export declare function debounceTime<T>(dueTime: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;