Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / internal / operators / mergeScan.d.ts
1 import { Operator } from '../Operator';
2 import { Subscriber } from '../Subscriber';
3 import { ObservableInput, OperatorFunction } from '../types';
4 import { SimpleOuterSubscriber } from '../innerSubscribe';
5 /**
6  * Applies an accumulator function over the source Observable where the
7  * accumulator function itself returns an Observable, then each intermediate
8  * Observable returned is merged into the output Observable.
9  *
10  * <span class="informal">It's like {@link scan}, but the Observables returned
11  * by the accumulator are merged into the outer Observable.</span>
12  *
13  * ## Example
14  * Count the number of click events
15  * ```ts
16  * import { fromEvent, of } from 'rxjs';
17  * import { mapTo, mergeScan } from 'rxjs/operators';
18  *
19  * const click$ = fromEvent(document, 'click');
20  * const one$ = click$.pipe(mapTo(1));
21  * const seed = 0;
22  * const count$ = one$.pipe(
23  *   mergeScan((acc, one) => of(acc + one), seed),
24  * );
25  * count$.subscribe(x => console.log(x));
26  *
27  * // Results:
28  * // 1
29  * // 2
30  * // 3
31  * // 4
32  * // ...and so on for each click
33  * ```
34  *
35  * @param {function(acc: R, value: T): Observable<R>} accumulator
36  * The accumulator function called on each source value.
37  * @param seed The initial accumulation value.
38  * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of
39  * input Observables being subscribed to concurrently.
40  * @return {Observable<R>} An observable of the accumulated values.
41  * @method mergeScan
42  * @owner Observable
43  */
44 export declare function mergeScan<T, R>(accumulator: (acc: R, value: T, index: number) => ObservableInput<R>, seed: R, concurrent?: number): OperatorFunction<T, R>;
45 export declare class MergeScanOperator<T, R> implements Operator<T, R> {
46     private accumulator;
47     private seed;
48     private concurrent;
49     constructor(accumulator: (acc: R, value: T, index: number) => ObservableInput<R>, seed: R, concurrent: number);
50     call(subscriber: Subscriber<R>, source: any): any;
51 }
52 /**
53  * We need this JSDoc comment for affecting ESDoc.
54  * @ignore
55  * @extends {Ignored}
56  */
57 export declare class MergeScanSubscriber<T, R> extends SimpleOuterSubscriber<T, R> {
58     private accumulator;
59     private acc;
60     private concurrent;
61     private hasValue;
62     private hasCompleted;
63     private buffer;
64     private active;
65     protected index: number;
66     constructor(destination: Subscriber<R>, accumulator: (acc: R, value: T, index: number) => ObservableInput<R>, acc: R, concurrent: number);
67     protected _next(value: any): void;
68     private _innerSub;
69     protected _complete(): void;
70     notifyNext(innerValue: R): void;
71     notifyComplete(): void;
72 }