UNPKG

1.63 kBTypeScriptView Raw
1import { Observable } from '../Observable';
2import { MonoTypeOperatorFunction, ObservableInput } from '../types';
3/**
4 * Returns an Observable that mirrors the source Observable with the exception of a `complete`. If the source
5 * Observable calls `complete`, this method will emit to the Observable returned from `notifier`. If that Observable
6 * calls `complete` or `error`, then this method will call `complete` or `error` on the child subscription. Otherwise
7 * this method will resubscribe to the source Observable.
8 *
9 * ![](repeatWhen.png)
10 *
11 * ## Example
12 *
13 * Repeat a message stream on click
14 *
15 * ```ts
16 * import { of, fromEvent, repeatWhen } from 'rxjs';
17 *
18 * const source = of('Repeat message');
19 * const documentClick$ = fromEvent(document, 'click');
20 *
21 * const result = source.pipe(repeatWhen(() => documentClick$));
22 *
23 * result.subscribe(data => console.log(data))
24 * ```
25 *
26 * @see {@link repeat}
27 * @see {@link retry}
28 * @see {@link retryWhen}
29 *
30 * @param notifier Function that receives an Observable of notifications with
31 * which a user can `complete` or `error`, aborting the repetition.
32 * @return A function that returns an `ObservableInput` that mirrors the source
33 * Observable with the exception of a `complete`.
34 * @deprecated Will be removed in v9 or v10. Use {@link repeat}'s {@link RepeatConfig#delay delay} option instead.
35 * Instead of `repeatWhen(() => notify$)`, use: `repeat({ delay: () => notify$ })`.
36 */
37export declare function repeatWhen<T>(notifier: (notifications: Observable<void>) => ObservableInput<any>): MonoTypeOperatorFunction<T>;
38//# sourceMappingURL=repeatWhen.d.ts.map
\No newline at end of file