1 /** PURE_IMPORTS_START tslib,_observable_from,_util_isArray,_OuterSubscriber,_InnerSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { from } from '../observable/from';
4 import { isArray } from '../util/isArray';
5 import { OuterSubscriber } from '../OuterSubscriber';
6 import { InnerSubscriber } from '../InnerSubscriber';
7 import { subscribeToResult } from '../util/subscribeToResult';
8 export function onErrorResumeNext() {
10 for (var _i = 0; _i < arguments.length; _i++) {
11 nextSources[_i] = arguments[_i];
13 if (nextSources.length === 1 && isArray(nextSources[0])) {
14 nextSources = nextSources[0];
16 return function (source) { return source.lift(new OnErrorResumeNextOperator(nextSources)); };
18 export function onErrorResumeNextStatic() {
20 for (var _i = 0; _i < arguments.length; _i++) {
21 nextSources[_i] = arguments[_i];
24 if (nextSources.length === 1 && isArray(nextSources[0])) {
25 nextSources = nextSources[0];
27 source = nextSources.shift();
28 return from(source, null).lift(new OnErrorResumeNextOperator(nextSources));
30 var OnErrorResumeNextOperator = /*@__PURE__*/ (function () {
31 function OnErrorResumeNextOperator(nextSources) {
32 this.nextSources = nextSources;
34 OnErrorResumeNextOperator.prototype.call = function (subscriber, source) {
35 return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources));
37 return OnErrorResumeNextOperator;
39 var OnErrorResumeNextSubscriber = /*@__PURE__*/ (function (_super) {
40 tslib_1.__extends(OnErrorResumeNextSubscriber, _super);
41 function OnErrorResumeNextSubscriber(destination, nextSources) {
42 var _this = _super.call(this, destination) || this;
43 _this.destination = destination;
44 _this.nextSources = nextSources;
47 OnErrorResumeNextSubscriber.prototype.notifyError = function (error, innerSub) {
48 this.subscribeToNextSource();
50 OnErrorResumeNextSubscriber.prototype.notifyComplete = function (innerSub) {
51 this.subscribeToNextSource();
53 OnErrorResumeNextSubscriber.prototype._error = function (err) {
54 this.subscribeToNextSource();
57 OnErrorResumeNextSubscriber.prototype._complete = function () {
58 this.subscribeToNextSource();
61 OnErrorResumeNextSubscriber.prototype.subscribeToNextSource = function () {
62 var next = this.nextSources.shift();
64 var innerSubscriber = new InnerSubscriber(this, undefined, undefined);
65 var destination = this.destination;
66 destination.add(innerSubscriber);
67 var innerSubscription = subscribeToResult(this, next, undefined, undefined, innerSubscriber);
68 if (innerSubscription !== innerSubscriber) {
69 destination.add(innerSubscription);
73 this.destination.complete();
76 return OnErrorResumeNextSubscriber;
78 //# sourceMappingURL=onErrorResumeNext.js.map