1 import { from } from '../observable/from';
2 import { isArray } from '../util/isArray';
3 import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
4 export function onErrorResumeNext(...nextSources) {
5 if (nextSources.length === 1 && isArray(nextSources[0])) {
6 nextSources = nextSources[0];
8 return (source) => source.lift(new OnErrorResumeNextOperator(nextSources));
10 export function onErrorResumeNextStatic(...nextSources) {
11 let source = undefined;
12 if (nextSources.length === 1 && isArray(nextSources[0])) {
13 nextSources = nextSources[0];
15 source = nextSources.shift();
16 return from(source).lift(new OnErrorResumeNextOperator(nextSources));
18 class OnErrorResumeNextOperator {
19 constructor(nextSources) {
20 this.nextSources = nextSources;
22 call(subscriber, source) {
23 return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources));
26 class OnErrorResumeNextSubscriber extends SimpleOuterSubscriber {
27 constructor(destination, nextSources) {
29 this.destination = destination;
30 this.nextSources = nextSources;
33 this.subscribeToNextSource();
36 this.subscribeToNextSource();
39 this.subscribeToNextSource();
43 this.subscribeToNextSource();
46 subscribeToNextSource() {
47 const next = this.nextSources.shift();
49 const innerSubscriber = new SimpleInnerSubscriber(this);
50 const destination = this.destination;
51 destination.add(innerSubscriber);
52 const innerSubscription = innerSubscribe(next, innerSubscriber);
53 if (innerSubscription !== innerSubscriber) {
54 destination.add(innerSubscription);
58 this.destination.complete();
62 //# sourceMappingURL=onErrorResumeNext.js.map