1
0
mirror of https://github.com/konvajs/konva.git synced 2025-04-24 02:58:14 +08:00
konva/test/setStats.js

30 lines
666 B
JavaScript
Raw Normal View History

window.requestAnimFrame = (function(callback) {
2017-07-29 00:40:07 +08:00
return (
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback) {
window.setTimeout(callback, 1000 / 30);
2017-07-29 00:40:07 +08:00
}
);
})();
stats = new Stats();
stats.setMode(0);
stats.domElement.style.position = 'fixed';
stats.domElement.style.left = '0px';
stats.domElement.style.top = '0px';
document.body.appendChild(stats.domElement);
function setStats() {
stats.begin();
requestAnimFrame(function() {
stats.end();
setStats();
});
}
setStats();