model/consoleState.js
function(message) {
        if (!this._tickList) {
            this._tickList = [];
            while (this._tickList.length < this._maxTicks) {
                this._tickList.push(0);
            }
        }

        if (!this._lastHeart) {
            this._lastHeart = Date.now();
            this._lastFpsUpdate = this._lastHeart;
            return;
        }

        var newHeart = Date.now();
        var newTick = newHeart - this._lastHeart;
        this._lastHeart = newHeart;

        this._tickSum -= this._tickList[this._tickIndex];
        this._tickSum += newTick;
        this._tickList[this._tickIndex] = newTick;
        if (++this._tickIndex == this._maxTicks) {
            this._tickIndex = 0;
        }
    }
function(message) {
        if (!this._tickList) {
            this._tickList = [];
            while (this._tickList.length < this._maxTicks) {
                this._tickList.push(0);
            }
        }

        if (!this._lastHeart) {
            this._lastHeart = Date.now();
            this._lastFpsUpdate = this._lastHeart;
            return;
        }

        var newHeart = Date.now();
        var newTick = newHeart - this._lastHeart;
        this._lastHeart = newHeart;

        this._tickSum -= this._tickList[this._tickIndex];
        this._tickSum += newTick;
        this._tickList[this._tickIndex] = newTick;
        if (++this._tickIndex == this._maxTicks) {
            this._tickIndex = 0;
        }
    }
function ( message ) { if ( ! this . _tickList ) { this . _tickList = [ ] ; while ( this . _tickList . length < this . _maxTicks ) { this . _tickList . push ( 0 ) ; } } if ( ! this . _lastHeart ) { this . _lastHeart = Date . now ( ) ; this . _lastFpsUpdate = this . _lastHeart ; return ; } var newHeart = Date . now ( ) ; var newTick = newHeart - this . _lastHeart ; this . _lastHeart = newHeart ; this . _tickSum -= this . _tickList [ this . _tickIndex ] ; this . _tickSum += newTick ; this . _tickList [ this . _tickIndex ] = newTick ; if ( ++ this . _tickIndex == this . _maxTicks ) { this . _tickIndex = 0 ; } }
Update the FPS whenever a heartbeat message is received from the app.
Update the FPS whenever a heartbeat message is received from the app .