@@ -20,10 +20,10 @@ export interface RetryConfig {
20
20
*/
21
21
delay ?: number | ( ( error : any , retryCount : number ) => ObservableInput < any > ) ;
22
22
/**
23
- * Whether or not to reset the retry counter on success.
24
- * Defaults to false .
23
+ * Whether or not to reset the retry counter when the retried subscription
24
+ * emits its first value .
25
25
*/
26
- resetOnSuccess ?: boolean ;
26
+ resetOnFirstValue ?: boolean ;
27
27
}
28
28
29
29
/**
@@ -67,21 +67,22 @@ export interface RetryConfig {
67
67
* // "Error!: Retried 2 times then quit!"
68
68
* ```
69
69
*
70
- * @param { number } count - Number of retry attempts before failing.
71
- * @param { boolean } resetOnSuccess - When set to `true` every successful emission will reset the error count
70
+ * @param count - Number of retry attempts before failing.
71
+ * @param resetOnSuccess - When set to `true` every successful emission will reset the error count
72
72
* @return A function that returns an Observable that will resubscribe to the
73
73
* source stream when the source stream errors, at most `count` times.
74
74
*/
75
75
export function retry < T > ( count ?: number ) : MonoTypeOperatorFunction < T > ;
76
76
77
77
/**
78
- * A more configurable means of retrying a source.
78
+ * Returns an observable that mirrors the source observable unless it errors. If it errors, the source observable
79
+ * will be resubscribed to (or "retried") based on the configuration passed here. See documentation
80
+ * for {@link RetryConfig} for more details.
79
81
*
80
- * If `delay` is provided as a `number`, after the source errors, the result will wait `delay` milliseconds,
81
- * then retry the source. If `delay` is a function, th
82
- * @param config The retry configuration
82
+ * @param config - The retry configuration
83
83
*/
84
84
export function retry < T > ( config : RetryConfig ) : MonoTypeOperatorFunction < T > ;
85
+
85
86
export function retry < T > ( configOrCount : number | RetryConfig = Infinity ) : MonoTypeOperatorFunction < T > {
86
87
let config : RetryConfig ;
87
88
if ( configOrCount && typeof configOrCount === 'object' ) {
@@ -91,7 +92,7 @@ export function retry<T>(configOrCount: number | RetryConfig = Infinity): MonoTy
91
92
count : configOrCount ,
92
93
} ;
93
94
}
94
- const { count = Infinity , delay, resetOnSuccess = false } = config ;
95
+ const { count = Infinity , delay, resetOnFirstValue : resetOnSuccess = false } = config ;
95
96
96
97
return count <= 0
97
98
? identity
0 commit comments