UNPKG

rxjs-retry-delay

Version:

RxJS retry pipeable operator with delay and max attempts strategy for RxJS >= 6

27 lines (26 loc) 885 B
import { Observable } from 'rxjs'; export interface IRetryStratetyConfig { /** * A delay in miliseconds. Default set to 1000ms */ delay?: number; /** * Number of maximum attempts. */ maxRetryAttempts?: number; /** * Factor by whitch the next delay will be multiplied. Default set to 1 */ scalingFactor?: number; /** * List of HTTP codes to be excluded from retrying. */ excludedStatusCodes?: number[]; /** * If true, retry count is being resetted after every successful emission (i.e. successful reconection to the server). * * Default: false */ resetRetryCountOnEmission?: boolean; } export declare const retryWithDelay: ({ delay, maxRetryAttempts, scalingFactor, excludedStatusCodes, resetRetryCountOnEmission }: IRetryStratetyConfig) => <T>(source: Observable<T>) => Observable<T>;