source: trip-planner-front/node_modules/rxjs/internal/operators/window.d.ts@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.7 KB
Line 
1import { Observable } from '../Observable';
2import { OperatorFunction } from '../types';
3/**
4 * Branch out the source Observable values as a nested Observable whenever
5 * `windowBoundaries` emits.
6 *
7 * <span class="informal">It's like {@link buffer}, but emits a nested Observable
8 * instead of an array.</span>
9 *
10 * ![](window.png)
11 *
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.
17 *
18 * ## Example
19 * In every window of 1 second each, emit at most 2 click events
20 * ```ts
21 * import { fromEvent, interval } from 'rxjs';
22 * import { window, mergeAll, map, take } from 'rxjs/operators';
23 *
24 * const clicks = fromEvent(document, 'click');
25 * const sec = interval(1000);
26 * const result = clicks.pipe(
27 * window(sec),
28 * map(win => win.pipe(take(2))), // each window has at most 2 emissions
29 * mergeAll(), // flatten the Observable-of-Observables
30 * );
31 * result.subscribe(x => console.log(x));
32 * ```
33 * @see {@link windowCount}
34 * @see {@link windowTime}
35 * @see {@link windowToggle}
36 * @see {@link windowWhen}
37 * @see {@link buffer}
38 *
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.
43 * @method window
44 * @owner Observable
45 */
46export declare function window<T>(windowBoundaries: Observable<any>): OperatorFunction<T, Observable<T>>;
Note: See TracBrowser for help on using the repository browser.