Code coverage report for cjs/scheduler/AnimationFrameAction.js

Statements: 42.11% (16 / 38)      Branches: 29.41% (5 / 17)      Functions: 42.86% (3 / 7)      Lines: 38.24% (13 / 34)      Ignored: none     

All files » cjs/scheduler/ » AnimationFrameAction.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 451 1 1 1   1 1 1 1 1     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 FutureAction_1 = require('./FutureAction');
var AnimationFrame_1 = require('../util/AnimationFrame');
var AnimationFrameAction = (function (_super) {
    __extends(AnimationFrameAction, _super);
    function AnimationFrameAction() {
        _super.apply(this, arguments);
    }
    AnimationFrameAction.prototype._schedule = function (state, delay) {
        if (delay === void 0) { delay = 0; }
        if (delay > 0) {
            return _super.prototype._schedule.call(this, state, delay);
        }
        this.delay = delay;
        this.state = state;
        var scheduler = this.scheduler;
        scheduler.actions.push(this);
        if (!scheduler.scheduledId) {
            scheduler.scheduledId = AnimationFrame_1.AnimationFrame.requestAnimationFrame(function () {
                scheduler.scheduledId = null;
                scheduler.flush();
            });
        }
        return this;
    };
    AnimationFrameAction.prototype._unsubscribe = function () {
        var scheduler = this.scheduler;
        var scheduledId = scheduler.scheduledId, actions = scheduler.actions;
        _super.prototype._unsubscribe.call(this);
        if (actions.length === 0) {
            scheduler.active = false;
            if (scheduledId != null) {
                scheduler.scheduledId = null;
                AnimationFrame_1.AnimationFrame.cancelAnimationFrame(scheduledId);
            }
        }
    };
    return AnimationFrameAction;
})(FutureAction_1.FutureAction);
exports.AnimationFrameAction = AnimationFrameAction;
//# sourceMappingURL=AnimationFrameAction.js.map