Phaser.FrameDebugger = function (game){ this.game = game; this.on = false ; this.frame = [] ; this.log = [] ; this.count = 0; this.max = 1; } ; Phaser.FrameDebugger.prototype = { start: function (){ this.frame = [Date.now()] ; } , stop: function (){ this.frame.push(Date.now()); this.log.push(this.frame); this.count++ ; if (this.count === this.max) { this.finish(); } } , finish: function (){ this.on = false ; console.log(this.log); } , record: function (max){ if (max === undefined) { max = 1; } if (this.on) { return ; } this.reset(); this.on = true ; this.max = max; } , reset: function (){ this.frame = [] ; this.log = [] ; this.count = 0; this.max = 1; } } ;