11.12.2012

//RISK! doStuff can take LONGER than 100 ms



    setInterval( function(){doStuff()} ,100 )


//THIS IS BETTER.



(function myfunction(){
   //Do stuff, finish
   doStuff(); 

   //wait after doStuff finishes then calls it again.
   //and I guess we can stop this loop as well.

   setTimeout(myfunction,100);
//we could also use arguments.callee but is deprecated

})();

From:  http://www.youtube.com/watch?v=i_qE1iAmjFg

No hay comentarios.:

Publicar un comentario