Code coverage report for cjs/operators/repeat.js

Statements: 96.36% (53 / 55)      Branches: 75% (18 / 24)      Functions: 100% (13 / 13)      Lines: 100% (47 / 47)      Ignored: none     

All files » cjs/operators/ » repeat.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 78 79 80 81 82 83 84 85 86 87    1 1   2   1   57   1   1   1   1   1 21   21     1 1 21   21 21     1 19     1     1 1   1 36   36 36 36 36         1 17 17     1 54 54 12   54     1 17 17 17   17     1 18 17 17       1     1  
'use strict';
 
exports.__esModule = true;
exports['default'] = repeat;
 
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 repeat() {
    var count = arguments.length <= 0 || arguments[0] === undefined ? -1 : arguments[0];
 
    return this.lift(new RepeatOperator(count, this));
}
 
var RepeatOperator = (function () {
    function RepeatOperator(count, original) {
        _classCallCheck(this, RepeatOperator);
 
        this.count = count;
        this.original = original;
    }
 
    RepeatOperator.prototype.call = function call(subscriber) {
        return new RepeatSubscriber(subscriber, this.count, this.original);
    };
 
    return RepeatOperator;
})();
 
var RepeatSubscriber = (function (_Subscriber) {
    _inherits(RepeatSubscriber, _Subscriber);
 
    function RepeatSubscriber(destination, count, original) {
        _classCallCheck(this, RepeatSubscriber);
 
        _Subscriber.call(this, destination);
        this.count = count;
        this.original = original;
        this.invalidateRepeat();
    }
 
    //# sourceMappingURL=repeat.js.map
 
    RepeatSubscriber.prototype.repeatSubscription = function repeatSubscription() {
        var state = { dest: this.destination, count: this.count, original: this.original };
        _schedulersImmediate2['default'].scheduleNow(RepeatSubscriber.dispatchSubscription, state);
    };
 
    RepeatSubscriber.prototype.invalidateRepeat = function invalidateRepeat() {
        var completed = this.count === 0;
        if (completed) {
            this.destination.complete();
        }
        return completed;
    };
 
    RepeatSubscriber.dispatchSubscription = function dispatchSubscription(_ref) {
        var dest = _ref.dest;
        var count = _ref.count;
        var original = _ref.original;
 
        return original.subscribe(new RepeatSubscriber(dest, count, original));
    };
 
    RepeatSubscriber.prototype._complete = function _complete() {
        if (!this.invalidateRepeat()) {
            this.count--;
            this.repeatSubscription();
        }
    };
 
    return RepeatSubscriber;
})(_Subscriber3['default']);
 
module.exports = exports['default'];
//# sourceMappingURL=repeat.js.map