Skip to content

Instantly share code, notes, and snippets.

@Najki
Forked from Raysharr/better_setInterval.js
Last active November 17, 2018 16:03
Show Gist options
  • Save Najki/5d005278752b4744f8b47049673da872 to your computer and use it in GitHub Desktop.
Save Najki/5d005278752b4744f8b47049673da872 to your computer and use it in GitHub Desktop.
Paul Irish's better setInterval
/* From Paul Irish */
/* instead of */
setInterval(function(){ doAsyncStuff(); },100);
/* use anonymous self-executing async function */
(function thisismyfunctionuniquename () {
$("#update").load("mypage.aspx",function () {
setTimeout(thisismyfunctionuniquename, 100);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment