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 OuterSubscriber_1 = require("../OuterSubscriber");
19 var InnerSubscriber_1 = require("../InnerSubscriber");
20 var subscribeToResult_1 = require("../util/subscribeToResult");
21 function onErrorResumeNext() {
23 for (var _i = 0; _i < arguments.length; _i++) {
24 nextSources[_i] = arguments[_i];
26 if (nextSources.length === 1 && isArray_1.isArray(nextSources[0])) {
27 nextSources = nextSources[0];
29 return function (source) { return source.lift(new OnErrorResumeNextOperator(nextSources)); };
31 exports.onErrorResumeNext = onErrorResumeNext;
32 function onErrorResumeNextStatic() {
34 for (var _i = 0; _i < arguments.length; _i++) {
35 nextSources[_i] = arguments[_i];
38 if (nextSources.length === 1 && isArray_1.isArray(nextSources[0])) {
39 nextSources = nextSources[0];
41 source = nextSources.shift();
42 return from_1.from(source, null).lift(new OnErrorResumeNextOperator(nextSources));
44 exports.onErrorResumeNextStatic = onErrorResumeNextStatic;
45 var OnErrorResumeNextOperator = (function () {
46 function OnErrorResumeNextOperator(nextSources) {
47 this.nextSources = nextSources;
49 OnErrorResumeNextOperator.prototype.call = function (subscriber, source) {
50 return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources));
52 return OnErrorResumeNextOperator;
54 var OnErrorResumeNextSubscriber = (function (_super) {
55 __extends(OnErrorResumeNextSubscriber, _super);
56 function OnErrorResumeNextSubscriber(destination, nextSources) {
57 var _this = _super.call(this, destination) || this;
58 _this.destination = destination;
59 _this.nextSources = nextSources;
62 OnErrorResumeNextSubscriber.prototype.notifyError = function (error, innerSub) {
63 this.subscribeToNextSource();
65 OnErrorResumeNextSubscriber.prototype.notifyComplete = function (innerSub) {
66 this.subscribeToNextSource();
68 OnErrorResumeNextSubscriber.prototype._error = function (err) {
69 this.subscribeToNextSource();
72 OnErrorResumeNextSubscriber.prototype._complete = function () {
73 this.subscribeToNextSource();
76 OnErrorResumeNextSubscriber.prototype.subscribeToNextSource = function () {
77 var next = this.nextSources.shift();
79 var innerSubscriber = new InnerSubscriber_1.InnerSubscriber(this, undefined, undefined);
80 var destination = this.destination;
81 destination.add(innerSubscriber);
82 var innerSubscription = subscribeToResult_1.subscribeToResult(this, next, undefined, undefined, innerSubscriber);
83 if (innerSubscription !== innerSubscriber) {
84 destination.add(innerSubscription);
88 this.destination.complete();
91 return OnErrorResumeNextSubscriber;
92 }(OuterSubscriber_1.OuterSubscriber));
93 //# sourceMappingURL=onErrorResumeNext.js.map