1 import { MonoTypeOperatorFunction, SubscribableOrPromise } from '../types';
3 * Ignores source values for a duration determined by another Observable, then
4 * emits the most recent value from the source Observable, then repeats this
7 * <span class="informal">It's like {@link auditTime}, but the silencing
8 * duration is determined by a second Observable.</span>
12 * `audit` is similar to `throttle`, but emits the last value from the silenced
13 * time window, instead of the first value. `audit` emits the most recent value
14 * from the source Observable on the output Observable as soon as its internal
15 * timer becomes disabled, and ignores source values while the timer is enabled.
16 * Initially, the timer is disabled. As soon as the first source value arrives,
17 * the timer is enabled by calling the `durationSelector` function with the
18 * source value, which returns the "duration" Observable. When the duration
19 * Observable emits a value or completes, the timer is disabled, then the most
20 * recent source value is emitted on the output Observable, and this process
21 * repeats for the next source value.
25 * Emit clicks at a rate of at most one click per second
27 * import { fromEvent, interval } from 'rxjs';
28 * import { audit } from 'rxjs/operators'
30 * const clicks = fromEvent(document, 'click');
31 * const result = clicks.pipe(audit(ev => interval(1000)));
32 * result.subscribe(x => console.log(x));
34 * @see {@link auditTime}
35 * @see {@link debounce}
36 * @see {@link delayWhen}
38 * @see {@link throttle}
40 * @param {function(value: T): SubscribableOrPromise} durationSelector A function
41 * that receives a value from the source Observable, for computing the silencing
42 * duration, returned as an Observable or a Promise.
43 * @return {Observable<T>} An Observable that performs rate-limiting of
44 * emissions from the source Observable.
48 export declare function audit<T>(durationSelector: (value: T) => SubscribableOrPromise<any>): MonoTypeOperatorFunction<T>;