UNPKG

1.6 kBTypeScriptView Raw
1import { MonoTypeOperatorFunction, ObservableInput } from '../types';
2/**
3 * Emits the values emitted by the source Observable until a `notifier`
4 * Observable emits a value.
5 *
6 * <span class="informal">Lets values pass until a second Observable,
7 * `notifier`, emits a value. Then, it completes.</span>
8 *
9 * ![](takeUntil.png)
10 *
11 * `takeUntil` subscribes and begins mirroring the source Observable. It also
12 * monitors a second Observable, `notifier` that you provide. If the `notifier`
13 * emits a value, the output Observable stops mirroring the source Observable
14 * and completes. If the `notifier` doesn't emit any value and completes
15 * then `takeUntil` will pass all values.
16 *
17 * ## Example
18 * Tick every second until the first click happens
19 * ```ts
20 * import { fromEvent, interval } from 'rxjs';
21 * import { takeUntil } from 'rxjs/operators';
22 *
23 * const source = interval(1000);
24 * const clicks = fromEvent(document, 'click');
25 * const result = source.pipe(takeUntil(clicks));
26 * result.subscribe(x => console.log(x));
27 * ```
28 *
29 * @see {@link take}
30 * @see {@link takeLast}
31 * @see {@link takeWhile}
32 * @see {@link skip}
33 *
34 * @param {Observable} notifier The Observable whose first emitted value will
35 * cause the output Observable of `takeUntil` to stop emitting values from the
36 * source Observable.
37 * @return A function that returns an Observable that emits the values from the
38 * source Observable until `notifier` emits its first value.
39 */
40export declare function takeUntil<T>(notifier: ObservableInput<any>): MonoTypeOperatorFunction<T>;
41//# sourceMappingURL=takeUntil.d.ts.map
\No newline at end of file