source: trip-planner-front/node_modules/rxjs/internal/operators/sample.js@ 6a80231

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

initial commit

  • Property mode set to 100644
File size: 2.2 KB
Line 
1"use strict";
2var __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})();
15Object.defineProperty(exports, "__esModule", { value: true });
16var innerSubscribe_1 = require("../innerSubscribe");
17function sample(notifier) {
18 return function (source) { return source.lift(new SampleOperator(notifier)); };
19}
20exports.sample = sample;
21var SampleOperator = (function () {
22 function SampleOperator(notifier) {
23 this.notifier = notifier;
24 }
25 SampleOperator.prototype.call = function (subscriber, source) {
26 var sampleSubscriber = new SampleSubscriber(subscriber);
27 var subscription = source.subscribe(sampleSubscriber);
28 subscription.add(innerSubscribe_1.innerSubscribe(this.notifier, new innerSubscribe_1.SimpleInnerSubscriber(sampleSubscriber)));
29 return subscription;
30 };
31 return SampleOperator;
32}());
33var SampleSubscriber = (function (_super) {
34 __extends(SampleSubscriber, _super);
35 function SampleSubscriber() {
36 var _this = _super !== null && _super.apply(this, arguments) || this;
37 _this.hasValue = false;
38 return _this;
39 }
40 SampleSubscriber.prototype._next = function (value) {
41 this.value = value;
42 this.hasValue = true;
43 };
44 SampleSubscriber.prototype.notifyNext = function () {
45 this.emitValue();
46 };
47 SampleSubscriber.prototype.notifyComplete = function () {
48 this.emitValue();
49 };
50 SampleSubscriber.prototype.emitValue = function () {
51 if (this.hasValue) {
52 this.hasValue = false;
53 this.destination.next(this.value);
54 }
55 };
56 return SampleSubscriber;
57}(innerSubscribe_1.SimpleOuterSubscriber));
58//# sourceMappingURL=sample.js.map
Note: See TracBrowser for help on using the repository browser.