Skip to content

Instantly share code, notes, and snippets.

@cemo
Forked from ehoch/gist:3189712
Created July 29, 2012 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cemo/3197136 to your computer and use it in GitHub Desktop.
Save cemo/3197136 to your computer and use it in GitHub Desktop.
writecapture2 mutex
var mutex = false;
function load_ads()
{
if (mutex) {
setTimeout("load_ads()", 100); // try again in 100 ms?
return;
}
mutex = true;
if (!$('#pushdown').html()) {
writeCapture($('#pushdown')[0], function() { setTimeout("load_ads()", 100) } ).write(pushdown_html).close();
}
else if (!$('#leaderboard').html()) {
writeCapture($('#leaderboard')[0], function() { setTimeout("load_ads()", 100) } ).write(leaderboard_html).close();
}
....
mutex = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment