Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / internal / operators / shareReplay.d.ts
1 import { MonoTypeOperatorFunction, SchedulerLike } from '../types';
2 export interface ShareReplayConfig {
3     bufferSize?: number;
4     windowTime?: number;
5     refCount: boolean;
6     scheduler?: SchedulerLike;
7 }
8 /**
9  * Share source and replay specified number of emissions on subscription.
10  *
11  * This operator is a specialization of `replay` that connects to a source observable
12  * and multicasts through a `ReplaySubject` constructed with the specified arguments.
13  * A successfully completed source will stay cached in the `shareReplayed observable` forever,
14  * but an errored source can be retried.
15  *
16  * ## Why use shareReplay?
17  * You generally want to use `shareReplay` when you have side-effects or taxing computations
18  * that you do not wish to be executed amongst multiple subscribers.
19  * It may also be valuable in situations where you know you will have late subscribers to
20  * a stream that need access to previously emitted values.
21  * This ability to replay values on subscription is what differentiates {@link share} and `shareReplay`.
22  *
23  * ![](shareReplay.png)
24  *
25  * ## Example
26  * ```ts
27  * import { interval } from 'rxjs';
28  * import { shareReplay, take } from 'rxjs/operators';
29  *
30  * const obs$ = interval(1000);
31  * const shared$ = obs$.pipe(
32  *   take(4),
33  *   shareReplay(3)
34  * );
35  * shared$.subscribe(x => console.log('source A: ', x));
36  * shared$.subscribe(y => console.log('source B: ', y));
37  *
38  * ```
39  *
40  * @see {@link publish}
41  * @see {@link share}
42  * @see {@link publishReplay}
43  *
44  * @param {Number} [bufferSize=Number.POSITIVE_INFINITY] Maximum element count of the replay buffer.
45  * @param {Number} [windowTime=Number.POSITIVE_INFINITY] Maximum time length of the replay buffer in milliseconds.
46  * @param {Scheduler} [scheduler] Scheduler where connected observers within the selector function
47  * will be invoked on.
48  * @return {Observable} An observable sequence that contains the elements of a sequence produced
49  * by multicasting the source sequence within a selector function.
50  * @method shareReplay
51  * @owner Observable
52  */
53 export declare function shareReplay<T>(config: ShareReplayConfig): MonoTypeOperatorFunction<T>;
54 export declare function shareReplay<T>(bufferSize?: number, windowTime?: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;