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);
9 return function (d, b) {
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
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() {
21 for (var _i = 0; _i < arguments.length; _i++) {
22 nextSources[_i] = arguments[_i];
24 if (nextSources.length === 1 && isArray_1.isArray(nextSources[0])) {
25 nextSources = nextSources[0];
27 return function (source) { return source.lift(new OnErrorResumeNextOperator(nextSources)); };
29 exports.onErrorResumeNext = onErrorResumeNext;
30 function onErrorResumeNextStatic() {
32 for (var _i = 0; _i < arguments.length; _i++) {
33 nextSources[_i] = arguments[_i];
35 var source = undefined;
36 if (nextSources.length === 1 && isArray_1.isArray(nextSources[0])) {
37 nextSources = nextSources[0];
39 source = nextSources.shift();
40 return from_1.from(source).lift(new OnErrorResumeNextOperator(nextSources));
42 exports.onErrorResumeNextStatic = onErrorResumeNextStatic;
43 var OnErrorResumeNextOperator = (function () {
44 function OnErrorResumeNextOperator(nextSources) {
45 this.nextSources = nextSources;
47 OnErrorResumeNextOperator.prototype.call = function (subscriber, source) {
48 return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources));
50 return OnErrorResumeNextOperator;
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;
60 OnErrorResumeNextSubscriber.prototype.notifyError = function () {
61 this.subscribeToNextSource();
63 OnErrorResumeNextSubscriber.prototype.notifyComplete = function () {
64 this.subscribeToNextSource();
66 OnErrorResumeNextSubscriber.prototype._error = function (err) {
67 this.subscribeToNextSource();
70 OnErrorResumeNextSubscriber.prototype._complete = function () {
71 this.subscribeToNextSource();
74 OnErrorResumeNextSubscriber.prototype.subscribeToNextSource = function () {
75 var next = this.nextSources.shift();
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);
86 this.destination.complete();
89 return OnErrorResumeNextSubscriber;
90 }(innerSubscribe_1.SimpleOuterSubscriber));
91 //# sourceMappingURL=onErrorResumeNext.js.map