Created
October 18, 2012 20:50
-
-
Save Raysharr/3914629 to your computer and use it in GitHub Desktop.
Paul Irish's better setInterval
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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