1 /** PURE_IMPORTS_START tslib,_observable_from,_util_isArray,_innerSubscribe PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { from } from '../observable/from';
4 import { isArray } from '../util/isArray';
5 import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
6 export function onErrorResumeNext() {
8 for (var _i = 0; _i < arguments.length; _i++) {
9 nextSources[_i] = arguments[_i];
11 if (nextSources.length === 1 && isArray(nextSources[0])) {
12 nextSources = nextSources[0];
14 return function (source) { return source.lift(new OnErrorResumeNextOperator(nextSources)); };
16 export function onErrorResumeNextStatic() {
18 for (var _i = 0; _i < arguments.length; _i++) {
19 nextSources[_i] = arguments[_i];
21 var source = undefined;
22 if (nextSources.length === 1 && isArray(nextSources[0])) {
23 nextSources = nextSources[0];
25 source = nextSources.shift();
26 return from(source).lift(new OnErrorResumeNextOperator(nextSources));
28 var OnErrorResumeNextOperator = /*@__PURE__*/ (function () {
29 function OnErrorResumeNextOperator(nextSources) {
30 this.nextSources = nextSources;
32 OnErrorResumeNextOperator.prototype.call = function (subscriber, source) {
33 return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources));
35 return OnErrorResumeNextOperator;
37 var OnErrorResumeNextSubscriber = /*@__PURE__*/ (function (_super) {
38 tslib_1.__extends(OnErrorResumeNextSubscriber, _super);
39 function OnErrorResumeNextSubscriber(destination, nextSources) {
40 var _this = _super.call(this, destination) || this;
41 _this.destination = destination;
42 _this.nextSources = nextSources;
45 OnErrorResumeNextSubscriber.prototype.notifyError = function () {
46 this.subscribeToNextSource();
48 OnErrorResumeNextSubscriber.prototype.notifyComplete = function () {
49 this.subscribeToNextSource();
51 OnErrorResumeNextSubscriber.prototype._error = function (err) {
52 this.subscribeToNextSource();
55 OnErrorResumeNextSubscriber.prototype._complete = function () {
56 this.subscribeToNextSource();
59 OnErrorResumeNextSubscriber.prototype.subscribeToNextSource = function () {
60 var next = this.nextSources.shift();
62 var innerSubscriber = new SimpleInnerSubscriber(this);
63 var destination = this.destination;
64 destination.add(innerSubscriber);
65 var innerSubscription = innerSubscribe(next, innerSubscriber);
66 if (innerSubscription !== innerSubscriber) {
67 destination.add(innerSubscription);
71 this.destination.complete();
74 return OnErrorResumeNextSubscriber;
75 }(SimpleOuterSubscriber));
76 //# sourceMappingURL=onErrorResumeNext.js.map