source: trip-planner-front/node_modules/rxjs/internal/operators/retry.d.ts@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.7 KB
Line 
1import { MonoTypeOperatorFunction } from '../types';
2/**
3 * Returns an Observable that mirrors the source Observable with the exception of an `error`. If the source Observable
4 * calls `error`, this method will resubscribe to the source Observable for a maximum of `count` resubscriptions (given
5 * as a number parameter) rather than propagating the `error` call.
6 *
7 * ![](retry.png)
8 *
9 * Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those emitted
10 * during failed subscriptions. For example, if an Observable fails at first but emits [1, 2] then succeeds the second
11 * time and emits: [1, 2, 3, 4, 5] then the complete stream of emissions and notifications
12 * would be: [1, 2, 1, 2, 3, 4, 5, `complete`].
13 *
14 * ## Example
15 * ```ts
16 * import { interval, of, throwError } from 'rxjs';
17 * import { mergeMap, retry } from 'rxjs/operators';
18 *
19 * const source = interval(1000);
20 * const example = source.pipe(
21 * mergeMap(val => {
22 * if(val > 5){
23 * return throwError('Error!');
24 * }
25 * return of(val);
26 * }),
27 * //retry 2 times on error
28 * retry(2)
29 * );
30 *
31 * const subscribe = example.subscribe({
32 * next: val => console.log(val),
33 * error: val => console.log(`${val}: Retried 2 times then quit!`)
34 * });
35 *
36 * // Output:
37 * // 0..1..2..3..4..5..
38 * // 0..1..2..3..4..5..
39 * // 0..1..2..3..4..5..
40 * // "Error!: Retried 2 times then quit!"
41 * ```
42 *
43 * @param {number} count - Number of retry attempts before failing.
44 * @return {Observable} The source Observable modified with the retry logic.
45 * @method retry
46 * @owner Observable
47 */
48export declare function retry<T>(count?: number): MonoTypeOperatorFunction<T>;
Note: See TracBrowser for help on using the repository browser.