Skip to content

Instantly share code, notes, and snippets.

@Raysharr
Created October 18, 2012 20:50
Show Gist options
  • Save Raysharr/3914629 to your computer and use it in GitHub Desktop.
Save Raysharr/3914629 to your computer and use it in GitHub Desktop.
Paul Irish's better setInterval
/* From Paul Irish */
/* instead of */
setInterval(function(){ doStuff(); },100);
/* use anonymous self-executing function */
(function thisismyfunctionuniquename(){
doStuff();
setTimeout(thisismyfunctionuniquename,100);
/* or async recursion */
$("#update").load("mypage.aspx",function(){
thisismyfunctionuniquename();
});
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment