Skip to content

Instantly share code, notes, and snippets.

@cemo
Forked from ehoch/gist:3189712
Created Jul 29, 2012
Embed
What would you like to do?
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