joewalnes / smoothie

Smoothie Charts: smooooooth JavaScript charts for realtime streaming data
http://smoothiecharts.org
Other
2.25k stars 232 forks source link

switch to requestAnimationFrame for rendering - v3 #28

Closed imrehg closed 11 years ago

imrehg commented 11 years ago

The original method of setTimeout for animation drains on system resources if the tab is not visible, It is somewhat mitigated by some of the modern browsers (Chrome and Firefox tested) which set a maximum one setTimeout call per second for background tabs, though this is not a behaviour to be relied upon.

The requestAnimationFrame API aims to fix that with these properties:

The "fps" option is also removed here, since it is now timed by the browser itself. It is by default equivalent to about 60 fps.

joewalnes commented 11 years ago

Sorry for delay in reviewing this.... been a bit busy.

The code looks great - thanks!

Before I merge, I just want to test on a handful of browsers. I'll do this later this week.

-Joe

imrehg commented 11 years ago

No problem at all, thanks a lot for the detailed feedback, it made the code so much better! :)