mirror of
https://github.com/adriancooney/console.snapshot.git
synced 2025-12-08 21:26:19 +00:00
Add state counter
This commit is contained in:
parent
b2d8e25a31
commit
a2f37fe6b9
@ -101,7 +101,7 @@
|
|||||||
|
|
||||||
Profile.prototype.outputToConsole = function() {
|
Profile.prototype.outputToConsole = function() {
|
||||||
var prevState = [], group = 1, scope = 1;
|
var prevState = [], group = 1, scope = 1;
|
||||||
var callCount = 0;
|
var callCount = 0, stateChanges = 0;
|
||||||
|
|
||||||
console.group("Canvas snapshot");
|
console.group("Canvas snapshot");
|
||||||
//console.log("%cFPS: %c" + this.FPS, "color: green", "color: #000"); Fix the formula!
|
//console.log("%cFPS: %c" + this.FPS, "color: green", "color: #000"); Fix the formula!
|
||||||
@ -126,7 +126,8 @@
|
|||||||
console.groupEnd();
|
console.groupEnd();
|
||||||
} else {
|
} else {
|
||||||
for(var key in state)
|
for(var key in state)
|
||||||
if(prevState[scope] && prevState[scope][key] !== state[key]) console.log("%c" + key + " %c= " + state[key], "color: purple; font-style: italic", "color: #000");
|
if(prevState[scope] && prevState[scope][key] !== state[key])
|
||||||
|
console.log("%c" + key + " %c= " + state[key], "color: purple; font-style: italic", "color: #000"), stateChanges++;
|
||||||
}
|
}
|
||||||
|
|
||||||
prevState[scope] = state;
|
prevState[scope] = state;
|
||||||
@ -141,6 +142,7 @@
|
|||||||
|
|
||||||
console.group("Statistics");
|
console.group("Statistics");
|
||||||
console.log("Function call count: ", callCount);
|
console.log("Function call count: ", callCount);
|
||||||
|
console.log("State change count: ", stateChanges);
|
||||||
console.groupEnd();
|
console.groupEnd();
|
||||||
|
|
||||||
console.groupEnd(); //End the major group
|
console.groupEnd(); //End the major group
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user