Created
April 29, 2013 19:24
-
-
Save jwalsh/5484027 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assume bkContinue is functionality that has a synchronous | |
// dependency on the tag | |
// Add a script request with an onload | |
window.bk_loaded = false; | |
function bkLoaded() { | |
// The interval / timeout clearing could be moved here | |
window.bk_loaded = true; | |
} | |
// This is the base implementation of the JS tag | |
document.write("<scr"+"ipt onload=\"bkLoaded\" src=\"http://tags.bluekai.com/site/14445?ret=js\"></script>"); | |
// Monitor for the completion of bk_loaded | |
var bk_monitor = window.setInterval(function() { | |
if (bk_loaded) { | |
// Stop monitoring | |
clearInterval(bk_monitor); | |
// Remove the timeout monitoring if the load doesn't finish | |
window.clearTimeout(bk_continue); | |
bkContinue(); | |
} | |
}, 50) | |
// Stop monitoring and continue | |
var bk_continue = window.setTimeout(function() { | |
// Set up default values or error notes | |
var bk_results = { | |
"campaigns": [ | |
] | |
}; | |
bkContinue(); | |
}, 500) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment