UNPKG

2.15 kBTypeScriptView Raw
1import { MonoTypeOperatorFunction, ObservableInput } from '../types';
2/**
3 * Returns an Observable that skips items emitted by the source Observable until a second Observable emits an item.
4 *
5 * The `skipUntil` operator causes the observable stream to skip the emission of values until the passed in observable
6 * emits the first value. This can be particularly useful in combination with user interactions, responses of HTTP
7 * requests or waiting for specific times to pass by.
8 *
9 * ![](skipUntil.png)
10 *
11 * Internally, the `skipUntil` operator subscribes to the passed in `notifier` `ObservableInput` (which gets converted
12 * to an Observable) in order to recognize the emission of its first value. When `notifier` emits next, the operator
13 * unsubscribes from it and starts emitting the values of the *source* observable until it completes or errors. It
14 * will never let the *source* observable emit any values if the `notifier` completes or throws an error without
15 * emitting a value before.
16 *
17 * ## Example
18 *
19 * In the following example, all emitted values of the interval observable are skipped until the user clicks anywhere
20 * within the page
21 *
22 * ```ts
23 * import { interval, fromEvent, skipUntil } from 'rxjs';
24 *
25 * const intervalObservable = interval(1000);
26 * const click = fromEvent(document, 'click');
27 *
28 * const emitAfterClick = intervalObservable.pipe(
29 * skipUntil(click)
30 * );
31 * // clicked at 4.6s. output: 5...6...7...8........ or
32 * // clicked at 7.3s. output: 8...9...10..11.......
33 * emitAfterClick.subscribe(value => console.log(value));
34 * ```
35 *
36 * @see {@link last}
37 * @see {@link skip}
38 * @see {@link skipWhile}
39 * @see {@link skipLast}
40 *
41 * @param notifier An `ObservableInput` that has to emit an item before the source Observable elements begin to
42 * be mirrored by the resulting Observable.
43 * @return A function that returns an Observable that skips items from the
44 * source Observable until the `notifier` Observable emits an item, then emits the
45 * remaining items.
46 */
47export declare function skipUntil<T>(notifier: ObservableInput<any>): MonoTypeOperatorFunction<T>;
48//# sourceMappingURL=skipUntil.d.ts.map
\No newline at end of file