Every new change
This commit is contained in:
45
node_modules/rxjs/_esm5/internal/operators/sample.js
generated
vendored
Normal file
45
node_modules/rxjs/_esm5/internal/operators/sample.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
/** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
|
||||
import * as tslib_1 from "tslib";
|
||||
import { OuterSubscriber } from '../OuterSubscriber';
|
||||
import { subscribeToResult } from '../util/subscribeToResult';
|
||||
export function sample(notifier) {
|
||||
return function (source) { return source.lift(new SampleOperator(notifier)); };
|
||||
}
|
||||
var SampleOperator = /*@__PURE__*/ (function () {
|
||||
function SampleOperator(notifier) {
|
||||
this.notifier = notifier;
|
||||
}
|
||||
SampleOperator.prototype.call = function (subscriber, source) {
|
||||
var sampleSubscriber = new SampleSubscriber(subscriber);
|
||||
var subscription = source.subscribe(sampleSubscriber);
|
||||
subscription.add(subscribeToResult(sampleSubscriber, this.notifier));
|
||||
return subscription;
|
||||
};
|
||||
return SampleOperator;
|
||||
}());
|
||||
var SampleSubscriber = /*@__PURE__*/ (function (_super) {
|
||||
tslib_1.__extends(SampleSubscriber, _super);
|
||||
function SampleSubscriber() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.hasValue = false;
|
||||
return _this;
|
||||
}
|
||||
SampleSubscriber.prototype._next = function (value) {
|
||||
this.value = value;
|
||||
this.hasValue = true;
|
||||
};
|
||||
SampleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
|
||||
this.emitValue();
|
||||
};
|
||||
SampleSubscriber.prototype.notifyComplete = function () {
|
||||
this.emitValue();
|
||||
};
|
||||
SampleSubscriber.prototype.emitValue = function () {
|
||||
if (this.hasValue) {
|
||||
this.hasValue = false;
|
||||
this.destination.next(this.value);
|
||||
}
|
||||
};
|
||||
return SampleSubscriber;
|
||||
}(OuterSubscriber));
|
||||
//# sourceMappingURL=sample.js.map
|
Reference in New Issue
Block a user