1 /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { Subscriber } from '../Subscriber';
4 export function retry(count) {
5 if (count === void 0) {
8 return function (source) { return source.lift(new RetryOperator(count, source)); };
10 var RetryOperator = /*@__PURE__*/ (function () {
11 function RetryOperator(count, source) {
15 RetryOperator.prototype.call = function (subscriber, source) {
16 return source.subscribe(new RetrySubscriber(subscriber, this.count, this.source));
20 var RetrySubscriber = /*@__PURE__*/ (function (_super) {
21 tslib_1.__extends(RetrySubscriber, _super);
22 function RetrySubscriber(destination, count, source) {
23 var _this = _super.call(this, destination) || this;
25 _this.source = source;
28 RetrySubscriber.prototype.error = function (err) {
29 if (!this.isStopped) {
30 var _a = this, source = _a.source, count = _a.count;
32 return _super.prototype.error.call(this, err);
34 else if (count > -1) {
35 this.count = count - 1;
37 source.subscribe(this._unsubscribeAndRecycle());
40 return RetrySubscriber;
42 //# sourceMappingURL=retry.js.map