Skip to content

Instantly share code, notes, and snippets.

@qwertypants
Created August 25, 2015 13:55
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 qwertypants/258796fb019dd20ff7fe to your computer and use it in GitHub Desktop.
Save qwertypants/258796fb019dd20ff7fe to your computer and use it in GitHub Desktop.
Fire an event when an window property is ready to be used. This assumes that an external script will add the new property on the window object.
// This uses Google tracking as an example
var interval = setInterval(function () {
console.log('searching..')
if (window._gaq) {
_gaq.push(['_trackPageview', 'Something']);
clearInterval(interval);
console.log('stop');
}
}, 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment