Skip to content

Instantly share code, notes, and snippets.

@paulkaplan
Created October 23, 2015 14:25
Show Gist options
  • Save paulkaplan/7bf2f120023bc9711aa6 to your computer and use it in GitHub Desktop.
Save paulkaplan/7bf2f120023bc9711aa6 to your computer and use it in GitHub Desktop.
Customized stats.js bookmarklet
javascript:(function() {
var script = document.createElement('script');
script.onload = function() {
/* Remove existing stats if it exists */
var existingStatsElement = document.getElementById('stats');
if (existingStatsElement) {
existingStatsElement.parentNode.removeChild(existingStatsElement);
}
var stats = new Stats();
stats.setMode(1); /* Default to frame time mode */
stats.domElement.style.cssText='position:fixed;left:0;top:0;z-index:10000';
document.body.appendChild(stats.domElement);
requestAnimationFrame(function loop(){
stats.update();
requestAnimationFrame(loop);
});
};
script.src='//rawgit.com/mrdoob/stats.js/master/build/stats.min.js';
document.head.appendChild(script);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment