8b1c1ef4d99094c78073d6a4dbb32ed6bf6c8beb
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / internal / operators / exhaust.js
1 "use strict";
2 var __extends = (this && this.__extends) || (function () {
3     var extendStatics = function (d, b) {
4         extendStatics = Object.setPrototypeOf ||
5             ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6             function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7         return extendStatics(d, b);
8     }
9     return function (d, b) {
10         extendStatics(d, b);
11         function __() { this.constructor = d; }
12         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13     };
14 })();
15 Object.defineProperty(exports, "__esModule", { value: true });
16 var OuterSubscriber_1 = require("../OuterSubscriber");
17 var subscribeToResult_1 = require("../util/subscribeToResult");
18 function exhaust() {
19     return function (source) { return source.lift(new SwitchFirstOperator()); };
20 }
21 exports.exhaust = exhaust;
22 var SwitchFirstOperator = (function () {
23     function SwitchFirstOperator() {
24     }
25     SwitchFirstOperator.prototype.call = function (subscriber, source) {
26         return source.subscribe(new SwitchFirstSubscriber(subscriber));
27     };
28     return SwitchFirstOperator;
29 }());
30 var SwitchFirstSubscriber = (function (_super) {
31     __extends(SwitchFirstSubscriber, _super);
32     function SwitchFirstSubscriber(destination) {
33         var _this = _super.call(this, destination) || this;
34         _this.hasCompleted = false;
35         _this.hasSubscription = false;
36         return _this;
37     }
38     SwitchFirstSubscriber.prototype._next = function (value) {
39         if (!this.hasSubscription) {
40             this.hasSubscription = true;
41             this.add(subscribeToResult_1.subscribeToResult(this, value));
42         }
43     };
44     SwitchFirstSubscriber.prototype._complete = function () {
45         this.hasCompleted = true;
46         if (!this.hasSubscription) {
47             this.destination.complete();
48         }
49     };
50     SwitchFirstSubscriber.prototype.notifyComplete = function (innerSub) {
51         this.remove(innerSub);
52         this.hasSubscription = false;
53         if (this.hasCompleted) {
54             this.destination.complete();
55         }
56     };
57     return SwitchFirstSubscriber;
58 }(OuterSubscriber_1.OuterSubscriber));
59 //# sourceMappingURL=exhaust.js.map