source: trip-planner-front/node_modules/rxjs/_esm2015/internal/operators/onErrorResumeNext.js@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.1 KB
Line 
1import { from } from '../observable/from';
2import { isArray } from '../util/isArray';
3import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
4export function onErrorResumeNext(...nextSources) {
5 if (nextSources.length === 1 && isArray(nextSources[0])) {
6 nextSources = nextSources[0];
7 }
8 return (source) => source.lift(new OnErrorResumeNextOperator(nextSources));
9}
10export function onErrorResumeNextStatic(...nextSources) {
11 let source = undefined;
12 if (nextSources.length === 1 && isArray(nextSources[0])) {
13 nextSources = nextSources[0];
14 }
15 source = nextSources.shift();
16 return from(source).lift(new OnErrorResumeNextOperator(nextSources));
17}
18class OnErrorResumeNextOperator {
19 constructor(nextSources) {
20 this.nextSources = nextSources;
21 }
22 call(subscriber, source) {
23 return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources));
24 }
25}
26class OnErrorResumeNextSubscriber extends SimpleOuterSubscriber {
27 constructor(destination, nextSources) {
28 super(destination);
29 this.destination = destination;
30 this.nextSources = nextSources;
31 }
32 notifyError() {
33 this.subscribeToNextSource();
34 }
35 notifyComplete() {
36 this.subscribeToNextSource();
37 }
38 _error(err) {
39 this.subscribeToNextSource();
40 this.unsubscribe();
41 }
42 _complete() {
43 this.subscribeToNextSource();
44 this.unsubscribe();
45 }
46 subscribeToNextSource() {
47 const next = this.nextSources.shift();
48 if (!!next) {
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);
55 }
56 }
57 else {
58 this.destination.complete();
59 }
60 }
61}
62//# sourceMappingURL=onErrorResumeNext.js.map
Note: See TracBrowser for help on using the repository browser.