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);
9 return function (d, b) {
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15 Object.defineProperty(exports, "__esModule", { value: true });
16 var OuterSubscriber_1 = require("../OuterSubscriber");
17 var subscribeToResult_1 = require("../util/subscribeToResult");
18 function sample(notifier) {
19 return function (source) { return source.lift(new SampleOperator(notifier)); };
21 exports.sample = sample;
22 var SampleOperator = (function () {
23 function SampleOperator(notifier) {
24 this.notifier = notifier;
26 SampleOperator.prototype.call = function (subscriber, source) {
27 var sampleSubscriber = new SampleSubscriber(subscriber);
28 var subscription = source.subscribe(sampleSubscriber);
29 subscription.add(subscribeToResult_1.subscribeToResult(sampleSubscriber, this.notifier));
32 return SampleOperator;
34 var SampleSubscriber = (function (_super) {
35 __extends(SampleSubscriber, _super);
36 function SampleSubscriber() {
37 var _this = _super !== null && _super.apply(this, arguments) || this;
38 _this.hasValue = false;
41 SampleSubscriber.prototype._next = function (value) {
45 SampleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
48 SampleSubscriber.prototype.notifyComplete = function () {
51 SampleSubscriber.prototype.emitValue = function () {
53 this.hasValue = false;
54 this.destination.next(this.value);
57 return SampleSubscriber;
58 }(OuterSubscriber_1.OuterSubscriber));
59 //# sourceMappingURL=sample.js.map