Skip to content

Instantly share code, notes, and snippets.

@mikehwagz
Created March 21, 2020 23:01
Show Gist options
  • Save mikehwagz/8526b6f2a277303f3d45e666b2c0a1c3 to your computer and use it in GitHub Desktop.
Save mikehwagz/8526b6f2a277303f3d45e666b2c0a1c3 to your computer and use it in GitHub Desktop.
const Stats = require('stats.js')
module.exports = function() {
const stats = new Stats()
stats.domElement.style.cssText =
'position:fixed;left:0;bottom:0px;z-index:10000'
stats.domElement.id = 'stats'
if (!document.getElementById('stats')) {
document.body.appendChild(stats.domElement)
}
requestAnimationFrame(update)
function update() {
stats.update()
requestAnimationFrame(update)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment