Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm2015 / internal / operators / onErrorResumeNext.js
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];
7     }
8     return (source) => source.lift(new OnErrorResumeNextOperator(nextSources));
9 }
10 export 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 }
18 class OnErrorResumeNextOperator {
19     constructor(nextSources) {
20         this.nextSources = nextSources;
21     }
22     call(subscriber, source) {
23         return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources));
24     }
25 }
26 class 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