1 | "use strict";
|
---|
2 | var __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 | })();
|
---|
15 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
16 | var from_1 = require("../observable/from");
|
---|
17 | var isArray_1 = require("../util/isArray");
|
---|
18 | var innerSubscribe_1 = require("../innerSubscribe");
|
---|
19 | function onErrorResumeNext() {
|
---|
20 | var nextSources = [];
|
---|
21 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
22 | nextSources[_i] = arguments[_i];
|
---|
23 | }
|
---|
24 | if (nextSources.length === 1 && isArray_1.isArray(nextSources[0])) {
|
---|
25 | nextSources = nextSources[0];
|
---|
26 | }
|
---|
27 | return function (source) { return source.lift(new OnErrorResumeNextOperator(nextSources)); };
|
---|
28 | }
|
---|
29 | exports.onErrorResumeNext = onErrorResumeNext;
|
---|
30 | function onErrorResumeNextStatic() {
|
---|
31 | var nextSources = [];
|
---|
32 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
33 | nextSources[_i] = arguments[_i];
|
---|
34 | }
|
---|
35 | var source = undefined;
|
---|
36 | if (nextSources.length === 1 && isArray_1.isArray(nextSources[0])) {
|
---|
37 | nextSources = nextSources[0];
|
---|
38 | }
|
---|
39 | source = nextSources.shift();
|
---|
40 | return from_1.from(source).lift(new OnErrorResumeNextOperator(nextSources));
|
---|
41 | }
|
---|
42 | exports.onErrorResumeNextStatic = onErrorResumeNextStatic;
|
---|
43 | var OnErrorResumeNextOperator = (function () {
|
---|
44 | function OnErrorResumeNextOperator(nextSources) {
|
---|
45 | this.nextSources = nextSources;
|
---|
46 | }
|
---|
47 | OnErrorResumeNextOperator.prototype.call = function (subscriber, source) {
|
---|
48 | return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources));
|
---|
49 | };
|
---|
50 | return OnErrorResumeNextOperator;
|
---|
51 | }());
|
---|
52 | var OnErrorResumeNextSubscriber = (function (_super) {
|
---|
53 | __extends(OnErrorResumeNextSubscriber, _super);
|
---|
54 | function OnErrorResumeNextSubscriber(destination, nextSources) {
|
---|
55 | var _this = _super.call(this, destination) || this;
|
---|
56 | _this.destination = destination;
|
---|
57 | _this.nextSources = nextSources;
|
---|
58 | return _this;
|
---|
59 | }
|
---|
60 | OnErrorResumeNextSubscriber.prototype.notifyError = function () {
|
---|
61 | this.subscribeToNextSource();
|
---|
62 | };
|
---|
63 | OnErrorResumeNextSubscriber.prototype.notifyComplete = function () {
|
---|
64 | this.subscribeToNextSource();
|
---|
65 | };
|
---|
66 | OnErrorResumeNextSubscriber.prototype._error = function (err) {
|
---|
67 | this.subscribeToNextSource();
|
---|
68 | this.unsubscribe();
|
---|
69 | };
|
---|
70 | OnErrorResumeNextSubscriber.prototype._complete = function () {
|
---|
71 | this.subscribeToNextSource();
|
---|
72 | this.unsubscribe();
|
---|
73 | };
|
---|
74 | OnErrorResumeNextSubscriber.prototype.subscribeToNextSource = function () {
|
---|
75 | var next = this.nextSources.shift();
|
---|
76 | if (!!next) {
|
---|
77 | var innerSubscriber = new innerSubscribe_1.SimpleInnerSubscriber(this);
|
---|
78 | var destination = this.destination;
|
---|
79 | destination.add(innerSubscriber);
|
---|
80 | var innerSubscription = innerSubscribe_1.innerSubscribe(next, innerSubscriber);
|
---|
81 | if (innerSubscription !== innerSubscriber) {
|
---|
82 | destination.add(innerSubscription);
|
---|
83 | }
|
---|
84 | }
|
---|
85 | else {
|
---|
86 | this.destination.complete();
|
---|
87 | }
|
---|
88 | };
|
---|
89 | return OnErrorResumeNextSubscriber;
|
---|
90 | }(innerSubscribe_1.SimpleOuterSubscriber));
|
---|
91 | //# sourceMappingURL=onErrorResumeNext.js.map |
---|