Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | import { Observable } from '../Observable';
|
---|
2 | import { MonoTypeOperatorFunction } 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 | * Repeat a message stream on click
|
---|
13 | * ```ts
|
---|
14 | * import { of, fromEvent } from 'rxjs';
|
---|
15 | * import { repeatWhen } from 'rxjs/operators';
|
---|
16 | *
|
---|
17 | * const source = of('Repeat message');
|
---|
18 | * const documentClick$ = fromEvent(document, 'click');
|
---|
19 | *
|
---|
20 | * source.pipe(repeatWhen(() => documentClick$)
|
---|
21 | * ).subscribe(data => console.log(data))
|
---|
22 | * ```
|
---|
23 | * @see {@link repeat}
|
---|
24 | * @see {@link retry}
|
---|
25 | * @see {@link retryWhen}
|
---|
26 | *
|
---|
27 | * @param {function(notifications: Observable): Observable} notifier - Receives an Observable of notifications with
|
---|
28 | * which a user can `complete` or `error`, aborting the repetition.
|
---|
29 | * @return {Observable} The source Observable modified with repeat logic.
|
---|
30 | * @method repeatWhen
|
---|
31 | * @owner Observable
|
---|
32 | */
|
---|
33 | export declare function repeatWhen<T>(notifier: (notifications: Observable<any>) => Observable<any>): MonoTypeOperatorFunction<T>;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.