Skip to content

Instantly share code, notes, and snippets.

@gcoop
Created December 1, 2010 10:26
Show Gist options
  • Save gcoop/723299 to your computer and use it in GitHub Desktop.
Save gcoop/723299 to your computer and use it in GitHub Desktop.
// Protected self calling pattern.
(function(window,document,$,undefined){
})(this,this.document,this.jQuery);
// setInterval replacement, async recursion.
// setInterval doesn't wait for completion even if the function is longer than the timeout, below does.
(function foobar() { // Recursive but doesn't fire before completed.
doStuff();
$('#update').load('data.php', function () {
foobar();
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment