1 import { Observable } from '../Observable';
2 import { OperatorFunction } from '../types';
4 * Branch out the source Observable values as a nested Observable whenever
5 * `windowBoundaries` emits.
7 * <span class="informal">It's like {@link buffer}, but emits a nested Observable
8 * instead of an array.</span>
12 * Returns an Observable that emits windows of items it collects from the source
13 * Observable. The output Observable emits connected, non-overlapping
14 * windows. It emits the current window and opens a new one whenever the
15 * Observable `windowBoundaries` emits an item. Because each window is an
16 * Observable, the output is a higher-order Observable.
19 * In every window of 1 second each, emit at most 2 click events
21 * import { fromEvent, interval } from 'rxjs';
22 * import { window, mergeAll, map, take } from 'rxjs/operators';
24 * const clicks = fromEvent(document, 'click');
25 * const sec = interval(1000);
26 * const result = clicks.pipe(
28 * map(win => win.pipe(take(2))), // each window has at most 2 emissions
29 * mergeAll(), // flatten the Observable-of-Observables
31 * result.subscribe(x => console.log(x));
33 * @see {@link windowCount}
34 * @see {@link windowTime}
35 * @see {@link windowToggle}
36 * @see {@link windowWhen}
39 * @param {Observable<any>} windowBoundaries An Observable that completes the
40 * previous window and starts a new window.
41 * @return {Observable<Observable<T>>} An Observable of windows, which are
42 * Observables emitting values of the source Observable.
46 export declare function window<T>(windowBoundaries: Observable<any>): OperatorFunction<T, Observable<T>>;