Code coverage report for cjs/operators/switch.js

Statements: 96.43% (54 / 56)      Branches: 76.92% (20 / 26)      Functions: 100% (15 / 15)      Lines: 100% (48 / 48)      Ignored: none     

All files » cjs/operators/ » switch.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 88 89 90    1 1   2   1   28   1   1   1   1   1 14     1 1 14     1 14     1     1 1   1 14   14 14 14         1 25 25 25     1 10 10 5       1 34 34 34 21 21       1 39     1 1     1 9 9 4       1     1  
'use strict';
 
exports.__esModule = true;
exports['default'] = _switch;
 
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);
 
function _switch() {
    return this.lift(new SwitchOperator());
}
 
var SwitchOperator = (function () {
    function SwitchOperator() {
        _classCallCheck(this, SwitchOperator);
    }
 
    SwitchOperator.prototype.call = function call(subscriber) {
        return new SwitchSubscriber(subscriber);
    };
 
    return SwitchOperator;
})();
 
var SwitchSubscriber = (function (_OuterSubscriber) {
    _inherits(SwitchSubscriber, _OuterSubscriber);
 
    function SwitchSubscriber(destination) {
        _classCallCheck(this, SwitchSubscriber);
 
        _OuterSubscriber.call(this, destination);
        this.active = 0;
        this.hasCompleted = false;
    }
 
    //# sourceMappingURL=switch.js.map
 
    SwitchSubscriber.prototype._next = function _next(value) {
        this.unsubscribeInner();
        this.active++;
        this.add(this.innerSubscription = _utilSubscribeToResult2['default'](this, value));
    };
 
    SwitchSubscriber.prototype._complete = function _complete() {
        this.hasCompleted = true;
        if (this.active === 0) {
            this.destination.complete();
        }
    };
 
    SwitchSubscriber.prototype.unsubscribeInner = function unsubscribeInner() {
        this.active = this.active > 0 ? this.active - 1 : 0;
        var innerSubscription = this.innerSubscription;
        if (innerSubscription) {
            innerSubscription.unsubscribe();
            this.remove(innerSubscription);
        }
    };
 
    SwitchSubscriber.prototype.notifyNext = function notifyNext(outerValue, innerValue) {
        this.destination.next(innerValue);
    };
 
    SwitchSubscriber.prototype.notifyError = function notifyError(err) {
        this.destination.error(err);
    };
 
    SwitchSubscriber.prototype.notifyComplete = function notifyComplete() {
        this.unsubscribeInner();
        if (this.hasCompleted && this.active === 0) {
            this.destination.complete();
        }
    };
 
    return SwitchSubscriber;
})(_OuterSubscriber3['default']);
 
module.exports = exports['default'];
//# sourceMappingURL=switch.js.map