Code coverage report for cjs/operators/mergeAll-support.js

Statements: 96.3% (52 / 54)      Branches: 80% (24 / 30)      Functions: 100% (11 / 11)      Lines: 100% (46 / 46)      Ignored: none     

All files » cjs/operators/ » mergeAll-support.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    1   2   1   128   1   1   1   1   1 1 64   64     1 64     1     1   1 1   1 64   64 64 64 64 64         1 170 136 16   120 120     34       1 57 57 7       1 84 84 84 84 26 58 28       1     1  
'use strict';
 
exports.__esModule = true;
 
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 _OuterSubscriber2 = require('../OuterSubscriber');
 
var _OuterSubscriber3 = _interopRequireDefault(_OuterSubscriber2);
 
var _utilSubscribeToResult = require('../util/subscribeToResult');
 
var _utilSubscribeToResult2 = _interopRequireDefault(_utilSubscribeToResult);
 
var MergeAllOperator = (function () {
    function MergeAllOperator(concurrent) {
        _classCallCheck(this, MergeAllOperator);
 
        this.concurrent = concurrent;
    }
 
    MergeAllOperator.prototype.call = function call(observer) {
        return new MergeAllSubscriber(observer, this.concurrent);
    };
 
    return MergeAllOperator;
})();
 
exports.MergeAllOperator = MergeAllOperator;
 
var MergeAllSubscriber = (function (_OuterSubscriber) {
    _inherits(MergeAllSubscriber, _OuterSubscriber);
 
    function MergeAllSubscriber(destination, concurrent) {
        _classCallCheck(this, MergeAllSubscriber);
 
        _OuterSubscriber.call(this, destination);
        this.concurrent = concurrent;
        this.hasCompleted = false;
        this.buffer = [];
        this.active = 0;
    }
 
    //# sourceMappingURL=mergeAll-support.js.map
 
    MergeAllSubscriber.prototype._next = function _next(observable) {
        if (this.active < this.concurrent) {
            if (observable._isScalar) {
                this.destination.next(observable.value);
            } else {
                this.active++;
                this.add(_utilSubscribeToResult2['default'](this, observable));
            }
        } else {
            this.buffer.push(observable);
        }
    };
 
    MergeAllSubscriber.prototype._complete = function _complete() {
        this.hasCompleted = true;
        if (this.active === 0 && this.buffer.length === 0) {
            this.destination.complete();
        }
    };
 
    MergeAllSubscriber.prototype.notifyComplete = function notifyComplete(innerSub) {
        var buffer = this.buffer;
        this.remove(innerSub);
        this.active--;
        if (buffer.length > 0) {
            this._next(buffer.shift());
        } else if (this.active === 0 && this.hasCompleted) {
            this.destination.complete();
        }
    };
 
    return MergeAllSubscriber;
})(_OuterSubscriber3['default']);
 
exports.MergeAllSubscriber = MergeAllSubscriber;
//# sourceMappingURL=mergeAll-support.js.map