Code coverage report for cjs/operators/sampleTime.js

Statements: 96% (48 / 50)      Branches: 68.18% (15 / 22)      Functions: 100% (12 / 12)      Lines: 100% (42 / 42)      Ignored: none     

All files » cjs/operators/ » sampleTime.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77    1 1   2   1   12   1   1   1   1   1 6   6     1 1 6   6 6     1 6     1     1 1   1 6   6 6 6 6 6     1 9 9     1 17 4       1     1 17 17   17 17     1  
'use strict';
 
exports.__esModule = true;
exports['default'] = sampleTime;
 
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
function _inherits(subClass, superClass) { Iif (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); Eif (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
 
function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
 
var _Subscriber2 = require('../Subscriber');
 
var _Subscriber3 = _interopRequireDefault(_Subscriber2);
 
var _schedulersNextTick = require('../schedulers/nextTick');
 
var _schedulersNextTick2 = _interopRequireDefault(_schedulersNextTick);
 
function sampleTime(delay) {
    var scheduler = arguments.length <= 1 || arguments[1] === undefined ? _schedulersNextTick2['default'] : arguments[1];
 
    return this.lift(new SampleTimeOperator(delay, scheduler));
}
 
var SampleTimeOperator = (function () {
    function SampleTimeOperator(delay, scheduler) {
        _classCallCheck(this, SampleTimeOperator);
 
        this.delay = delay;
        this.scheduler = scheduler;
    }
 
    SampleTimeOperator.prototype.call = function call(subscriber) {
        return new SampleTimeSubscriber(subscriber, this.delay, this.scheduler);
    };
 
    return SampleTimeOperator;
})();
 
var SampleTimeSubscriber = (function (_Subscriber) {
    _inherits(SampleTimeSubscriber, _Subscriber);
 
    function SampleTimeSubscriber(destination, delay, scheduler) {
        _classCallCheck(this, SampleTimeSubscriber);
 
        _Subscriber.call(this, destination);
        this.delay = delay;
        this.scheduler = scheduler;
        this.hasValue = false;
        this.add(scheduler.schedule(dispatchNotification, delay, { subscriber: this, delay: delay }));
    }
 
    SampleTimeSubscriber.prototype._next = function _next(value) {
        this.lastValue = value;
        this.hasValue = true;
    };
 
    SampleTimeSubscriber.prototype.notifyNext = function notifyNext() {
        if (this.hasValue) {
            this.destination.next(this.lastValue);
        }
    };
 
    return SampleTimeSubscriber;
})(_Subscriber3['default']);
 
function dispatchNotification(state) {
    var subscriber = state.subscriber;
    var delay = state.delay;
 
    subscriber.notifyNext();
    this.schedule(state, delay);
}
//# sourceMappingURL=sampleTime.js.map
module.exports = exports['default'];
//# sourceMappingURL=sampleTime.js.map