source: trip-planner-front/node_modules/rxjs/internal/operators/retryWhen.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[6a3a178]1"use strict";
2var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 }
9 return function (d, b) {
10 extendStatics(d, b);
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13 };
14})();
15Object.defineProperty(exports, "__esModule", { value: true });
16var Subject_1 = require("../Subject");
17var innerSubscribe_1 = require("../innerSubscribe");
18function retryWhen(notifier) {
19 return function (source) { return source.lift(new RetryWhenOperator(notifier, source)); };
20}
21exports.retryWhen = retryWhen;
22var RetryWhenOperator = (function () {
23 function RetryWhenOperator(notifier, source) {
24 this.notifier = notifier;
25 this.source = source;
26 }
27 RetryWhenOperator.prototype.call = function (subscriber, source) {
28 return source.subscribe(new RetryWhenSubscriber(subscriber, this.notifier, this.source));
29 };
30 return RetryWhenOperator;
31}());
32var RetryWhenSubscriber = (function (_super) {
33 __extends(RetryWhenSubscriber, _super);
34 function RetryWhenSubscriber(destination, notifier, source) {
35 var _this = _super.call(this, destination) || this;
36 _this.notifier = notifier;
37 _this.source = source;
38 return _this;
39 }
40 RetryWhenSubscriber.prototype.error = function (err) {
41 if (!this.isStopped) {
42 var errors = this.errors;
43 var retries = this.retries;
44 var retriesSubscription = this.retriesSubscription;
45 if (!retries) {
46 errors = new Subject_1.Subject();
47 try {
48 var notifier = this.notifier;
49 retries = notifier(errors);
50 }
51 catch (e) {
52 return _super.prototype.error.call(this, e);
53 }
54 retriesSubscription = innerSubscribe_1.innerSubscribe(retries, new innerSubscribe_1.SimpleInnerSubscriber(this));
55 }
56 else {
57 this.errors = undefined;
58 this.retriesSubscription = undefined;
59 }
60 this._unsubscribeAndRecycle();
61 this.errors = errors;
62 this.retries = retries;
63 this.retriesSubscription = retriesSubscription;
64 errors.next(err);
65 }
66 };
67 RetryWhenSubscriber.prototype._unsubscribe = function () {
68 var _a = this, errors = _a.errors, retriesSubscription = _a.retriesSubscription;
69 if (errors) {
70 errors.unsubscribe();
71 this.errors = undefined;
72 }
73 if (retriesSubscription) {
74 retriesSubscription.unsubscribe();
75 this.retriesSubscription = undefined;
76 }
77 this.retries = undefined;
78 };
79 RetryWhenSubscriber.prototype.notifyNext = function () {
80 var _unsubscribe = this._unsubscribe;
81 this._unsubscribe = null;
82 this._unsubscribeAndRecycle();
83 this._unsubscribe = _unsubscribe;
84 this.source.subscribe(this);
85 };
86 return RetryWhenSubscriber;
87}(innerSubscribe_1.SimpleOuterSubscriber));
88//# sourceMappingURL=retryWhen.js.map
Note: See TracBrowser for help on using the repository browser.