display probe function to help debugging mobile etc.
This commit is contained in:
parent
30cf666f88
commit
bd13fedba5
|
@ -32,7 +32,8 @@
|
|||
clear = function() {
|
||||
window.probes = {
|
||||
clear: clear,
|
||||
measure: measure
|
||||
measure: measure,
|
||||
displayProbes: displayProbes
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -113,6 +114,41 @@
|
|||
};
|
||||
};
|
||||
|
||||
var displayProbes = function(){
|
||||
var pre;
|
||||
var text = "";
|
||||
var body = document.getElementsByTagName("body")[0];
|
||||
|
||||
for(var prop in window.probes){
|
||||
var probe = window.probes[prop];
|
||||
if(probe && probe.count){
|
||||
text += prop + ": " + probe.time + " ( " + probe.count + " )\n";
|
||||
}
|
||||
}
|
||||
|
||||
pre = document.getElementById("__probes");
|
||||
|
||||
if(!body){
|
||||
return;
|
||||
}
|
||||
|
||||
if(pre){
|
||||
pre.textContent = text;
|
||||
pre.innerText = text;
|
||||
return;
|
||||
}
|
||||
|
||||
pre = document.createElement("pre");
|
||||
|
||||
pre.textContent = text;
|
||||
pre.innerText = text;
|
||||
pre.setAttribute("style", "position: fixed; bottom: 25px; left: 50px; z-index: 99999; border: 1px solid #777; padding: 10px; background-color: rgba(255,255,255, 0.8);");
|
||||
pre.id = "__probes";
|
||||
body.appendChild(pre);
|
||||
};
|
||||
|
||||
|
||||
// setInterval(displayProbes, 1000);
|
||||
clear();
|
||||
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue