Code coverage report for cjs/scheduler/AsapAction.js

Statements: 97.44% (38 / 39)      Branches: 73.33% (11 / 15)      Functions: 100% (7 / 7)      Lines: 97.22% (35 / 36)      Ignored: none     

All files » cjs/scheduler/ » AsapAction.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 471 1 1 1   1 1 1 1 1 2   1 6 6     6 6 6 6 3 3 2 2 2     6   1 2 2 2 2 2 2   2 1 1     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 Immediate_1 = require('../util/Immediate');
var QueueAction_1 = require('./QueueAction');
var AsapAction = (function (_super) {
    __extends(AsapAction, _super);
    function AsapAction() {
        _super.apply(this, arguments);
    }
    AsapAction.prototype.schedule = function (state) {
        var _this = this;
        Iif (this.isUnsubscribed) {
            return this;
        }
        this.state = state;
        var scheduler = this.scheduler;
        scheduler.actions.push(this);
        if (!scheduler.scheduled) {
            scheduler.scheduled = true;
            this.id = Immediate_1.Immediate.setImmediate(function () {
                _this.id = null;
                _this.scheduler.scheduled = false;
                _this.scheduler.flush();
            });
        }
        return this;
    };
    AsapAction.prototype.unsubscribe = function () {
        var id = this.id;
        var scheduler = this.scheduler;
        _super.prototype.unsubscribe.call(this);
        Eif (scheduler.actions.length === 0) {
            scheduler.active = false;
            scheduler.scheduled = false;
        }
        if (id) {
            this.id = null;
            Immediate_1.Immediate.clearImmediate(id);
        }
    };
    return AsapAction;
})(QueueAction_1.QueueAction);
exports.AsapAction = AsapAction;
//# sourceMappingURL=AsapAction.js.map