Code coverage report for cjs/operators/extended/timeInterval.js

Statements: 95.65% (44 / 46)      Branches: 65% (13 / 20)      Functions: 100% (11 / 11)      Lines: 100% (38 / 38)      Ignored: none     

All files » cjs/operators/extended/ » timeInterval.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    1 1   2   1   32   1   1   1   1   1 8   8     1 16   16 16     1       1 1 8   8     1 8     1     1 1   1 8   8 8 8 8         1 8 8 8 8     1    
'use strict';
 
exports.__esModule = true;
exports['default'] = timeInterval;
 
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 _schedulersImmediate = require('../../schedulers/immediate');
 
var _schedulersImmediate2 = _interopRequireDefault(_schedulersImmediate);
 
function timeInterval() {
    var scheduler = arguments.length <= 0 || arguments[0] === undefined ? _schedulersImmediate2['default'] : arguments[0];
 
    return this.lift(new TimeIntervalOperator(scheduler));
}
 
var TimeInterval = function TimeInterval(value, interval) {
    _classCallCheck(this, TimeInterval);
 
    this.value = value;
    this.interval = interval;
};
 
exports.TimeInterval = TimeInterval;
 
;
 
var TimeIntervalOperator = (function () {
    function TimeIntervalOperator(scheduler) {
        _classCallCheck(this, TimeIntervalOperator);
 
        this.scheduler = scheduler;
    }
 
    TimeIntervalOperator.prototype.call = function call(observer) {
        return new TimeIntervalSubscriber(observer, this.scheduler);
    };
 
    return TimeIntervalOperator;
})();
 
var TimeIntervalSubscriber = (function (_Subscriber) {
    _inherits(TimeIntervalSubscriber, _Subscriber);
 
    function TimeIntervalSubscriber(destination, scheduler) {
        _classCallCheck(this, TimeIntervalSubscriber);
 
        _Subscriber.call(this, destination);
        this.scheduler = scheduler;
        this.lastTime = 0;
        this.lastTime = scheduler.now();
    }
 
    //# sourceMappingURL=timeInterval.js.map
 
    TimeIntervalSubscriber.prototype._next = function _next(value) {
        var now = this.scheduler.now();
        var span = now - this.lastTime;
        this.lastTime = now;
        this.destination.next(new TimeInterval(value, span));
    };
 
    return TimeIntervalSubscriber;
})(_Subscriber3['default']);
//# sourceMappingURL=timeInterval.js.map