DefinitelyTyped/types/stats.js/stats.js-tests.ts
2017-11-20 17:18:26 -05:00

24 lines
427 B
TypeScript

const stats = new Stats();
stats.showPanel( 1 ); // 0: fps, 1: ms, 2: mb, 3+: custom
document.body.appendChild( stats.dom );
const panel = stats.addPanel(
new Stats.Panel('custom', 'red', 'pink'));
function animate() {
stats.begin();
// monitored code goes here
// $ExpectType number
stats.end();
panel.update(40, 100);
requestAnimationFrame( animate );
}
requestAnimationFrame( animate );