Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / internal / operators / debounce.d.ts
1 import { MonoTypeOperatorFunction, SubscribableOrPromise } from '../types';
2 /**
3  * Emits a value from the source Observable only after a particular time span
4  * determined by another Observable has passed without another source emission.
5  *
6  * <span class="informal">It's like {@link debounceTime}, but the time span of
7  * emission silence is determined by a second Observable.</span>
8  *
9  * ![](debounce.png)
10  *
11  * `debounce` delays values emitted by the source Observable, but drops previous
12  * pending delayed emissions if a new value arrives on the source Observable.
13  * This operator keeps track of the most recent value from the source
14  * Observable, and spawns a duration Observable by calling the
15  * `durationSelector` function. The value is emitted only when the duration
16  * Observable emits a value or completes, and if no other value was emitted on
17  * the source Observable since the duration Observable was spawned. If a new
18  * value appears before the duration Observable emits, the previous value will
19  * be dropped and will not be emitted on the output Observable.
20  *
21  * Like {@link debounceTime}, this is a rate-limiting operator, and also a
22  * delay-like operator since output emissions do not necessarily occur at the
23  * same time as they did on the source Observable.
24  *
25  * ## Example
26  * Emit the most recent click after a burst of clicks
27  * ```ts
28  * import { fromEvent, interval } from 'rxjs';
29  * import { debounce } from 'rxjs/operators';
30  *
31  * const clicks = fromEvent(document, 'click');
32  * const result = clicks.pipe(debounce(() => interval(1000)));
33  * result.subscribe(x => console.log(x));
34  * ```
35  *
36  * @see {@link audit}
37  * @see {@link debounceTime}
38  * @see {@link delayWhen}
39  * @see {@link throttle}
40  *
41  * @param {function(value: T): SubscribableOrPromise} durationSelector A function
42  * that receives a value from the source Observable, for computing the timeout
43  * duration for each source value, returned as an Observable or a Promise.
44  * @return {Observable} An Observable that delays the emissions of the source
45  * Observable by the specified duration Observable returned by
46  * `durationSelector`, and may drop some values if they occur too frequently.
47  * @method debounce
48  * @owner Observable
49  */
50 export declare function debounce<T>(durationSelector: (value: T) => SubscribableOrPromise<any>): MonoTypeOperatorFunction<T>;