Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / internal / operators / windowTime.d.ts
1 import { Observable } from '../Observable';
2 import { OperatorFunction, SchedulerLike } from '../types';
3 /**
4  * Branch out the source Observable values as a nested Observable periodically
5  * in time.
6  *
7  * <span class="informal">It's like {@link bufferTime}, but emits a nested
8  * Observable instead of an array.</span>
9  *
10  * ![](windowTime.png)
11  *
12  * Returns an Observable that emits windows of items it collects from the source
13  * Observable. The output Observable starts a new window periodically, as
14  * determined by the `windowCreationInterval` argument. It emits each window
15  * after a fixed timespan, specified by the `windowTimeSpan` argument. When the
16  * source Observable completes or encounters an error, the output Observable
17  * emits the current window and propagates the notification from the source
18  * Observable. If `windowCreationInterval` is not provided, the output
19  * Observable starts a new window when the previous window of duration
20  * `windowTimeSpan` completes. If `maxWindowCount` is provided, each window
21  * will emit at most fixed number of values. Window will complete immediately
22  * after emitting last value and next one still will open as specified by
23  * `windowTimeSpan` and `windowCreationInterval` arguments.
24  *
25  * ## Examples
26  * In every window of 1 second each, emit at most 2 click events
27  * ```ts
28  * import { fromEvent } from 'rxjs';
29  * import { windowTime, map, mergeAll, take } from 'rxjs/operators';
30  *
31  * const clicks = fromEvent(document, 'click');
32  * const result = clicks.pipe(
33  *   windowTime(1000),
34  *   map(win => win.pipe(take(2))), // each window has at most 2 emissions
35  *   mergeAll(),                    // flatten the Observable-of-Observables
36  * );
37  * result.subscribe(x => console.log(x));
38  * ```
39  *
40  * Every 5 seconds start a window 1 second long, and emit at most 2 click events per window
41  * ```ts
42  * import { fromEvent } from 'rxjs';
43  * import { windowTime, map, mergeAll, take } from 'rxjs/operators';
44  *
45  * const clicks = fromEvent(document, 'click');
46  * const result = clicks.pipe(
47  *   windowTime(1000, 5000),
48  *   map(win => win.pipe(take(2))), // each window has at most 2 emissions
49  *   mergeAll(),                    // flatten the Observable-of-Observables
50  * );
51  * result.subscribe(x => console.log(x));
52  * ```
53  *
54  * Same as example above but with maxWindowCount instead of take
55  * ```ts
56  * import { fromEvent } from 'rxjs';
57  * import { windowTime, mergeAll } from 'rxjs/operators';
58  *
59  * const clicks = fromEvent(document, 'click');
60  * const result = clicks.pipe(
61  *   windowTime(1000, 5000, 2), // each window has still at most 2 emissions
62  *   mergeAll(),                // flatten the Observable-of-Observables
63  * );
64  * result.subscribe(x => console.log(x));
65  * ```
66  *
67  * @see {@link window}
68  * @see {@link windowCount}
69  * @see {@link windowToggle}
70  * @see {@link windowWhen}
71  * @see {@link bufferTime}
72  *
73  * @param {number} windowTimeSpan The amount of time to fill each window.
74  * @param {number} [windowCreationInterval] The interval at which to start new
75  * windows.
76  * @param {number} [maxWindowSize=Number.POSITIVE_INFINITY] Max number of
77  * values each window can emit before completion.
78  * @param {SchedulerLike} [scheduler=async] The scheduler on which to schedule the
79  * intervals that determine window boundaries.
80  * @return {Observable<Observable<T>>} An observable of windows, which in turn
81  * are Observables.
82  * @method windowTime
83  * @owner Observable
84  */
85 export declare function windowTime<T>(windowTimeSpan: number, scheduler?: SchedulerLike): OperatorFunction<T, Observable<T>>;
86 export declare function windowTime<T>(windowTimeSpan: number, windowCreationInterval: number, scheduler?: SchedulerLike): OperatorFunction<T, Observable<T>>;
87 export declare function windowTime<T>(windowTimeSpan: number, windowCreationInterval: number, maxWindowSize: number, scheduler?: SchedulerLike): OperatorFunction<T, Observable<T>>;