UNPKG

1.57 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 *
19 * Tick every second until the first click happens
20 *
21 * ```ts
22 * import { interval, fromEvent, takeUntil } from 'rxjs';
23 *
24 * const source = interval(1000);
25 * const clicks = fromEvent(document, 'click');
26 * const result = source.pipe(takeUntil(clicks));
27 * result.subscribe(x => console.log(x));
28 * ```
29 *
30 * @see {@link take}
31 * @see {@link takeLast}
32 * @see {@link takeWhile}
33 * @see {@link skip}
34 *
35 * @param {Observable} notifier The Observable whose first emitted value will
36 * cause the output Observable of `takeUntil` to stop emitting values from the
37 * source Observable.
38 * @return A function that returns an Observable that emits the values from the
39 * source Observable until `notifier` emits its first value.
40 */
41export declare function takeUntil<T>(notifier: ObservableInput<any>): MonoTypeOperatorFunction<T>;
42//# sourceMappingURL=takeUntil.d.ts.map
\No newline at end of file