import { Observable, MonoTypeOperatorFunction } from 'rxjs'; /** * @description * Limits the number of synchronous emitted a value from the source Observable to * one emitted value per * durationSelector e.g. [`AnimationFrame`](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame), then repeats * this process for every tick of the browsers event loop. * * The coalesce operator is based on the [throttle](https://rxjs-dev.firebaseapp.com/api/operators/throttle) operator. * In addition to that is provides emitted values for the trailing end only, as well as maintaining a context to scope * coalescing. * * @param {function(value: T): Observable} durationSelector - A required function * that receives a value from the source Observable, for computing the silencing * duration for each source value, returned as an Observable or a Promise. * A `requestAnimationFrame`-based selector is the recommended choice. * @param scope * Defaults to `{ leading: false, trailing: true }`. The default scoping is per subscriber. * @return {Observable} An Observable that performs the coalesce operation to * limit the rate of emissions from the source. * * @usageNotes * Emit clicks at a rate of at most one click per second * ```typescript * import { interval, fromEvent } from 'rxjs'; * import { coalesceWith } from '@rx-angular/cdk/coalescing'; * * const setTimeoutDurationSelector = interval(500); * const clicks = fromEvent(document, 'click'); * const result = clicks.pipe(coalesceWith(setTimeoutDurationSelector)); * result.subscribe(x => console.log(x)); * ``` */ declare function coalesceWith(durationSelector: Observable, scope?: Record): MonoTypeOperatorFunction; interface CoalescingManager { remove: (scope: Record) => void; add: (scope: Record) => void; isCoalescing: (scope: Record) => boolean; } declare const coalescingManager: CoalescingManager; type coalescingObj = object; interface RxCoalescingOptions { scope?: coalescingObj; } export { coalesceWith, coalescingManager }; export type { CoalescingManager, RxCoalescingOptions, coalescingObj };