source: trip-planner-front/node_modules/rxjs/internal/operators/windowToggle.d.ts

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

initial commit

  • Property mode set to 100644
File size: 2.0 KB
Line 
1import { Observable } from '../Observable';
2import { OperatorFunction } from '../types';
3/**
4 * Branch out the source Observable values as a nested Observable starting from
5 * an emission from `openings` and ending when the output of `closingSelector`
6 * emits.
7 *
8 * <span class="informal">It's like {@link bufferToggle}, but emits a nested
9 * Observable instead of an array.</span>
10 *
11 * ![](windowToggle.png)
12 *
13 * Returns an Observable that emits windows of items it collects from the source
14 * Observable. The output Observable emits windows that contain those items
15 * emitted by the source Observable between the time when the `openings`
16 * Observable emits an item and when the Observable returned by
17 * `closingSelector` emits an item.
18 *
19 * ## Example
20 * Every other second, emit the click events from the next 500ms
21 * ```ts
22 * import { fromEvent, interval, EMPTY } from 'rxjs';
23 * import { windowToggle, mergeAll } from 'rxjs/operators';
24 *
25 * const clicks = fromEvent(document, 'click');
26 * const openings = interval(1000);
27 * const result = clicks.pipe(
28 * windowToggle(openings, i => i % 2 ? interval(500) : EMPTY),
29 * mergeAll()
30 * );
31 * result.subscribe(x => console.log(x));
32 * ```
33 *
34 * @see {@link window}
35 * @see {@link windowCount}
36 * @see {@link windowTime}
37 * @see {@link windowWhen}
38 * @see {@link bufferToggle}
39 *
40 * @param {Observable<O>} openings An observable of notifications to start new
41 * windows.
42 * @param {function(value: O): Observable} closingSelector A function that takes
43 * the value emitted by the `openings` observable and returns an Observable,
44 * which, when it emits (either `next` or `complete`), signals that the
45 * associated window should complete.
46 * @return {Observable<Observable<T>>} An observable of windows, which in turn
47 * are Observables.
48 * @method windowToggle
49 * @owner Observable
50 */
51export declare function windowToggle<T, O>(openings: Observable<O>, closingSelector: (openValue: O) => Observable<any>): OperatorFunction<T, Observable<T>>;
Note: See TracBrowser for help on using the repository browser.