setInterval can be bad js because of its nature to continuously get called rather the methods inside is lagging or not.
setInterval(function() { doStuff.. }, 100)
A better approach is to use a self executing anonymous function.
(function() { doStuff.. setTimeout(arguments.callee, 100) })();
The only problem is that arguments.callee is deprecated so a work around is to name the anonymous function.
(function blah() { doStuff.. setTimeout(blah, 100) })();
Nice trick! thanks
Thank you!!