*blog... kind of... *rss 



stats.js
Some of you may have realised already that I've been using a Javascript FPS counter on some of my experiments.

Originally it had exactly the same look as the Actionscript version but, as far as I know, you can't query the system to get the amount of memory the application is using from Javascript. So 2 of the 4 common values of the Actionscript version were empty. That made me reconsider the design and tried to improve it a bit. And after using it for quite a while I think it's ready.



As you can see it has two modes, FPS and MS. Just click on the widget to switch between them. I may change MS to use greens instead of cyan to match the Actionscript version a bit more. Thoughts?

Unfortunately this time the code is not as simple as the Actionscript version, but I think it's still simple enough.

var stats = new Stats();
parentElement.appendChild(stats.domElement);

setInterval(function () {

    stats.update();

}, 1000/60);

Find the source code, compressed file and more examples at the project page on github.

15 comments written so far...

Thanks for this component, helps me a lot. For your info: I've found that IE chokes on the implementation of Stats, and put the code above in a try / catch block.
Is that IE9? Or IE8-? (Not a fan of adding browser specific code/detection stuff ;P)
Actually in Google Chrome you can query the memory usage. Here is one I ported from AS3 as well for my JS experiments.

http://www.coursevector.com/projects/orion/jsdemo/
Wow, didn't now that! :) Also, really nice port! Do you mind if I include it in the main repository?

http://github.com/mrdoob/Hi-ReS-Stats
Only briefly tried Stats in IE8, looks like addEventListener & canvas calls are incompatible with IE.
execellent!!!
but remeber you've already übber surpassed the expectations of javascript from its conception feel comfortable with things like this, shit happens.
:(

"you can't query the system to get the amount of memory the application is usin"
JaK, what about reading the comments? Turns out you can.
%20AND%201=1
%20AND%201=2
AND 1=1/*
AND 1=2/*
' AND '1'='1
' AND '1'='2
' AND 1=1/*
' AND 1=2/*

Have your say!



Name:

Website:

Comment: