Actualizacion maquina principal
[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 { OuterSubscriber } from '../OuterSubscriber';
4 import { InnerSubscriber } from '../InnerSubscriber';
5 import { subscribeToResult } from '../util/subscribeToResult';
6 export function onErrorResumeNext(...nextSources) {
7     if (nextSources.length === 1 && isArray(nextSources[0])) {
8         nextSources = nextSources[0];
9     }
10     return (source) => source.lift(new OnErrorResumeNextOperator(nextSources));
11 }
12 export function onErrorResumeNextStatic(...nextSources) {
13     let source = null;
14     if (nextSources.length === 1 && isArray(nextSources[0])) {
15         nextSources = nextSources[0];
16     }
17     source = nextSources.shift();
18     return from(source, null).lift(new OnErrorResumeNextOperator(nextSources));
19 }
20 class OnErrorResumeNextOperator {
21     constructor(nextSources) {
22         this.nextSources = nextSources;
23     }
24     call(subscriber, source) {
25         return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources));
26     }
27 }
28 class OnErrorResumeNextSubscriber extends OuterSubscriber {
29     constructor(destination, nextSources) {
30         super(destination);
31         this.destination = destination;
32         this.nextSources = nextSources;
33     }
34     notifyError(error, innerSub) {
35         this.subscribeToNextSource();
36     }
37     notifyComplete(innerSub) {
38         this.subscribeToNextSource();
39     }
40     _error(err) {
41         this.subscribeToNextSource();
42         this.unsubscribe();
43     }
44     _complete() {
45         this.subscribeToNextSource();
46         this.unsubscribe();
47     }
48     subscribeToNextSource() {
49         const next = this.nextSources.shift();
50         if (!!next) {
51             const innerSubscriber = new InnerSubscriber(this, undefined, undefined);
52             const destination = this.destination;
53             destination.add(innerSubscriber);
54             const innerSubscription = subscribeToResult(this, next, undefined, undefined, innerSubscriber);
55             if (innerSubscription !== innerSubscriber) {
56                 destination.add(innerSubscription);
57             }
58         }
59         else {
60             this.destination.complete();
61         }
62     }
63 }
64 //# sourceMappingURL=onErrorResumeNext.js.map