source: trip-planner-front/node_modules/rxjs/_esm5/internal/operators/sample.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/** PURE_IMPORTS_START tslib,_innerSubscribe PURE_IMPORTS_END */
2import * as tslib_1 from "tslib";
3import { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';
4export function sample(notifier) {
5 return function (source) { return source.lift(new SampleOperator(notifier)); };
6}
7var 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}());
19var 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
Note: See TracBrowser for help on using the repository browser.