Skip to content

Instantly share code, notes, and snippets.

@ehoch
Created July 27, 2012 18:42
Show Gist options
  • Save ehoch/3189712 to your computer and use it in GitHub Desktop.
Save ehoch/3189712 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