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