Actualizacion maquina principal
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm2015 / internal / operators / exhaust.js
1 import { OuterSubscriber } from '../OuterSubscriber';
2 import { subscribeToResult } from '../util/subscribeToResult';
3 export function exhaust() {
4     return (source) => source.lift(new SwitchFirstOperator());
5 }
6 class SwitchFirstOperator {
7     call(subscriber, source) {
8         return source.subscribe(new SwitchFirstSubscriber(subscriber));
9     }
10 }
11 class SwitchFirstSubscriber extends OuterSubscriber {
12     constructor(destination) {
13         super(destination);
14         this.hasCompleted = false;
15         this.hasSubscription = false;
16     }
17     _next(value) {
18         if (!this.hasSubscription) {
19             this.hasSubscription = true;
20             this.add(subscribeToResult(this, value));
21         }
22     }
23     _complete() {
24         this.hasCompleted = true;
25         if (!this.hasSubscription) {
26             this.destination.complete();
27         }
28     }
29     notifyComplete(innerSub) {
30         this.remove(innerSub);
31         this.hasSubscription = false;
32         if (this.hasCompleted) {
33             this.destination.complete();
34         }
35     }
36 }
37 //# sourceMappingURL=exhaust.js.map