UNPKG

@reactivex/ix-esnext-esm

Version:

The Interactive Extensions for JavaScript

1 lines 1.42 kB
{"version":3,"sources":["asynciterable/operators/retry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD;;;;;;;;GAQG;AACH,MAAM,UAAU,KAAK,CAAU,QAAgB,CAAC,CAAC;IAC/C,OAAO,SAAS,qBAAqB,CAAC,MAA8B;QAClE,OAAO,IAAI,qBAAqB,CAAU,WAAW,CAAyB,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IAChG,CAAC,CAAC;AACJ,CAAC","file":"retry.js","sourcesContent":["import { AsyncIterableX } from '../asynciterablex';\nimport { repeatValue } from '../../iterable/repeatvalue';\nimport { CatchAllAsyncIterable } from '../catcherror';\nimport { MonoTypeOperatorAsyncFunction } from '../../interfaces';\n\n/**\n * Retries the async-iterable instance the number of given times. If not supplied, it will try infinitely.\n *\n * @export\n * @template TSource The type of the elements in the source sequence.\n * @param {number} [count=-1] An optional number of times to retry, otherwise is set to infinite retries\n * @returns {MonoTypeOperatorAsyncFunction<TSource>} An async-iterable sequence producing the elements of the\n * given sequence repeatedly until it terminates successfully.\n */\nexport function retry<TSource>(count: number = -1): MonoTypeOperatorAsyncFunction<TSource> {\n return function retryOperatorFunction(source: AsyncIterable<TSource>): AsyncIterableX<TSource> {\n return new CatchAllAsyncIterable<TSource>(repeatValue<AsyncIterable<TSource>>(source, count));\n };\n}\n"]}