Code coverage report for cjs/operators/windowWhen.js

Statements: 89.61% (69 / 77)      Branches: 63.64% (14 / 22)      Functions: 83.33% (15 / 18)      Lines: 91.3% (63 / 69)      Ignored: none     

All files » cjs/operators/ » windowWhen.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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127    1 1   4   2   9   1   1   1   1   1   1   1   1   1   1 1     1 1 1   1     1 1     1     1 1   1 1   1 1 1 1     1 8     1         1 1 1     1 7 7 6 6   7 7 7   7 7 7         7 7       1     1 1   1 7   7 7         1 6     1       1       1     1  
'use strict';
 
exports.__esModule = true;
exports['default'] = window;
 
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 _Subscriber3 = require('../Subscriber');
 
var _Subscriber4 = _interopRequireDefault(_Subscriber3);
 
var _Subject = require('../Subject');
 
var _Subject2 = _interopRequireDefault(_Subject);
 
var _Subscription = require('../Subscription');
 
var _Subscription2 = _interopRequireDefault(_Subscription);
 
var _utilTryCatch = require('../util/tryCatch');
 
var _utilTryCatch2 = _interopRequireDefault(_utilTryCatch);
 
var _utilErrorObject = require('../util/errorObject');
 
function window(closingSelector) {
    return this.lift(new WindowOperator(closingSelector));
}
 
var WindowOperator = (function () {
    function WindowOperator(closingSelector) {
        _classCallCheck(this, WindowOperator);
 
        this.closingSelector = closingSelector;
    }
 
    WindowOperator.prototype.call = function call(subscriber) {
        return new WindowSubscriber(subscriber, this.closingSelector);
    };
 
    return WindowOperator;
})();
 
var WindowSubscriber = (function (_Subscriber) {
    _inherits(WindowSubscriber, _Subscriber);
 
    function WindowSubscriber(destination, closingSelector) {
        _classCallCheck(this, WindowSubscriber);
 
        _Subscriber.call(this, destination);
        this.closingSelector = closingSelector;
        this.window = new _Subject2['default']();
        this.openWindow();
    }
 
    WindowSubscriber.prototype._next = function _next(value) {
        this.window.next(value);
    };
 
    WindowSubscriber.prototype._error = function _error(err) {
        this.window.error(err);
        this.destination.error(err);
    };
 
    WindowSubscriber.prototype._complete = function _complete() {
        this.window.complete();
        this.destination.complete();
    };
 
    WindowSubscriber.prototype.openWindow = function openWindow() {
        var prevClosingNotification = this.closingNotification;
        if (prevClosingNotification) {
            this.remove(prevClosingNotification);
            prevClosingNotification.unsubscribe();
        }
        var prevWindow = this.window;
        Eif (prevWindow) {
            prevWindow.complete();
        }
        this.destination.next(this.window = new _Subject2['default']());
        var closingNotifier = _utilTryCatch2['default'](this.closingSelector)();
        Iif (closingNotifier === _utilErrorObject.errorObject) {
            var err = closingNotifier.e;
            this.destination.error(err);
            this.window.error(err);
        } else {
            var closingNotification = this.closingNotification = new _Subscription2['default']();
            this.add(closingNotification.add(closingNotifier._subscribe(new WindowClosingNotifierSubscriber(this))));
        }
    };
 
    return WindowSubscriber;
})(_Subscriber4['default']);
 
var WindowClosingNotifierSubscriber = (function (_Subscriber2) {
    _inherits(WindowClosingNotifierSubscriber, _Subscriber2);
 
    function WindowClosingNotifierSubscriber(parent) {
        _classCallCheck(this, WindowClosingNotifierSubscriber);
 
        _Subscriber2.call(this, null);
        this.parent = parent;
    }
 
    //# sourceMappingURL=windowWhen.js.map
 
    WindowClosingNotifierSubscriber.prototype._next = function _next() {
        this.parent.openWindow();
    };
 
    WindowClosingNotifierSubscriber.prototype._error = function _error(err) {
        this.parent.error(err);
    };
 
    WindowClosingNotifierSubscriber.prototype._complete = function _complete() {
        // noop
    };
 
    return WindowClosingNotifierSubscriber;
})(_Subscriber4['default']);
 
module.exports = exports['default'];
//# sourceMappingURL=windowWhen.js.map