Code coverage report for cjs/subject/AsyncSubject.js

Statements: 100% (38 / 38)      Branches: 84.62% (11 / 13)      Functions: 100% (7 / 7)      Lines: 100% (35 / 35)      Ignored: none     

All files » cjs/subject/ » AsyncSubject.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 491 1 1 1   1 1 1 1 33 33 33 33   1 57 4   57   1 52 52   1 20 20 20   20 20 20 17 18 18 18       3 3     20   1   1  
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) Eif (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subject_1 = require('../Subject');
var AsyncSubject = (function (_super) {
    __extends(AsyncSubject, _super);
    function AsyncSubject() {
        _super.call(this);
        this._value = void 0;
        this._hasNext = false;
        this._isScalar = false;
    }
    AsyncSubject.prototype._subscribe = function (subscriber) {
        if (this.completeSignal && this._hasNext) {
            subscriber.next(this._value);
        }
        return _super.prototype._subscribe.call(this, subscriber);
    };
    AsyncSubject.prototype._next = function (value) {
        this._value = value;
        this._hasNext = true;
    };
    AsyncSubject.prototype._complete = function () {
        var index = -1;
        var observers = this.observers;
        var len = observers.length;
        // optimization -- block next, complete, and unsubscribe while dispatching
        this.observers = void 0; // optimization
        this.isUnsubscribed = true;
        if (this._hasNext) {
            while (++index < len) {
                var o = observers[index];
                o.next(this._value);
                o.complete();
            }
        }
        else {
            while (++index < len) {
                observers[index].complete();
            }
        }
        this.isUnsubscribed = false;
    };
    return AsyncSubject;
})(Subject_1.Subject);
exports.AsyncSubject = AsyncSubject;
//# sourceMappingURL=AsyncSubject.js.map