1 import { Observable } from '../Observable';
2 import { OperatorFunction } from '../types';
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`
8 * <span class="informal">It's like {@link bufferToggle}, but emits a nested
9 * Observable instead of an array.</span>
11 * ![](windowToggle.png)
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.
20 * Every other second, emit the click events from the next 500ms
22 * import { fromEvent, interval, EMPTY } from 'rxjs';
23 * import { windowToggle, mergeAll } from 'rxjs/operators';
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),
31 * result.subscribe(x => console.log(x));
35 * @see {@link windowCount}
36 * @see {@link windowTime}
37 * @see {@link windowWhen}
38 * @see {@link bufferToggle}
40 * @param {Observable<O>} openings An observable of notifications to start new
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
48 * @method windowToggle
51 export declare function windowToggle<T, O>(openings: Observable<O>, closingSelector: (openValue: O) => Observable<any>): OperatorFunction<T, Observable<T>>;