work.suroh.tk/node_modules/rxjs/operators/retry.js.map

1 line
3.5 KiB
Plaintext

{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/operators/retry.ts"],"names":[],"mappings":";;;;;;AACA,2BAA2B,eAAe,CAAC,CAAA;AAM3C;;;;;;;;;;;;;;;GAeG;AACH,eAAyB,KAAkB;IAAlB,qBAAkB,GAAlB,SAAiB,CAAC;IACzC,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,EAA7C,CAA6C,CAAC;AAClF,CAAC;AAFe,aAAK,QAEpB,CAAA;AAED;IACE,uBAAoB,KAAa,EACb,MAAqB;QADrB,UAAK,GAAL,KAAK,CAAQ;QACb,WAAM,GAAN,MAAM,CAAe;IACzC,CAAC;IAED,4BAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACpF,CAAC;IACH,oBAAC;AAAD,CAAC,AARD,IAQC;AAED;;;;GAIG;AACH;IAAiC,mCAAa;IAC5C,yBAAY,WAA4B,EACpB,KAAa,EACb,MAAqB;QACvC,kBAAM,WAAW,CAAC,CAAC;QAFD,UAAK,GAAL,KAAK,CAAQ;QACb,WAAM,GAAN,MAAM,CAAe;IAEzC,CAAC;IACD,+BAAK,GAAL,UAAM,GAAQ;QACZ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;YACpB,IAAA,SAA8B,EAAtB,kBAAM,EAAE,gBAAK,CAAU;YAC/B,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC;gBAChB,MAAM,CAAC,gBAAK,CAAC,KAAK,YAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;YAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBACtB,IAAI,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;YACzB,CAAC;YACD,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IACH,sBAAC;AAAD,CAAC,AAjBD,CAAiC,uBAAU,GAiB1C","sourcesContent":["import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Observable } from '../Observable';\nimport { TeardownLogic } from '../Subscription';\n\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/**\n * Returns an Observable that mirrors the source Observable with the exception of an `error`. If the source Observable\n * calls `error`, this method will resubscribe to the source Observable for a maximum of `count` resubscriptions (given\n * as a number parameter) rather than propagating the `error` call.\n *\n * <img src=\"./img/retry.png\" width=\"100%\">\n *\n * Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those emitted\n * during failed subscriptions. For example, if an Observable fails at first but emits [1, 2] then succeeds the second\n * time and emits: [1, 2, 3, 4, 5] then the complete stream of emissions and notifications\n * would be: [1, 2, 1, 2, 3, 4, 5, `complete`].\n * @param {number} count - Number of retry attempts before failing.\n * @return {Observable} The source Observable modified with the retry logic.\n * @method retry\n * @owner Observable\n */\nexport function retry<T>(count: number = -1): MonoTypeOperatorFunction<T> {\n return (source: Observable<T>) => source.lift(new RetryOperator(count, source));\n}\n\nclass RetryOperator<T> implements Operator<T, T> {\n constructor(private count: number,\n private source: Observable<T>) {\n }\n\n call(subscriber: Subscriber<T>, source: any): TeardownLogic {\n return source.subscribe(new RetrySubscriber(subscriber, this.count, this.source));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass RetrySubscriber<T> extends Subscriber<T> {\n constructor(destination: Subscriber<any>,\n private count: number,\n private source: Observable<T>) {\n super(destination);\n }\n error(err: any) {\n if (!this.isStopped) {\n const { source, count } = this;\n if (count === 0) {\n return super.error(err);\n } else if (count > -1) {\n this.count = count - 1;\n }\n source.subscribe(this._unsubscribeAndRecycle());\n }\n }\n}\n"]}