Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm5 / internal / operators / sample.js
1 /** PURE_IMPORTS_START tslib,_innerSubscribe PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';
4 export function sample(notifier) {
5     return function (source) { return source.lift(new SampleOperator(notifier)); };
6 }
7 var SampleOperator = /*@__PURE__*/ (function () {
8     function SampleOperator(notifier) {
9         this.notifier = notifier;
10     }
11     SampleOperator.prototype.call = function (subscriber, source) {
12         var sampleSubscriber = new SampleSubscriber(subscriber);
13         var subscription = source.subscribe(sampleSubscriber);
14         subscription.add(innerSubscribe(this.notifier, new SimpleInnerSubscriber(sampleSubscriber)));
15         return subscription;
16     };
17     return SampleOperator;
18 }());
19 var SampleSubscriber = /*@__PURE__*/ (function (_super) {
20     tslib_1.__extends(SampleSubscriber, _super);
21     function SampleSubscriber() {
22         var _this = _super !== null && _super.apply(this, arguments) || this;
23         _this.hasValue = false;
24         return _this;
25     }
26     SampleSubscriber.prototype._next = function (value) {
27         this.value = value;
28         this.hasValue = true;
29     };
30     SampleSubscriber.prototype.notifyNext = function () {
31         this.emitValue();
32     };
33     SampleSubscriber.prototype.notifyComplete = function () {
34         this.emitValue();
35     };
36     SampleSubscriber.prototype.emitValue = function () {
37         if (this.hasValue) {
38             this.hasValue = false;
39             this.destination.next(this.value);
40         }
41     };
42     return SampleSubscriber;
43 }(SimpleOuterSubscriber));
44 //# sourceMappingURL=sample.js.map