Skip to content

Instantly share code, notes, and snippets.

@dlemphers
Created February 6, 2012 23:21
Show Gist options
  • Save dlemphers/1755828 to your computer and use it in GitHub Desktop.
Save dlemphers/1755828 to your computer and use it in GitHub Desktop.
JavaScript WaitForEvent function
function waitForEvent(waitFunction, callback) {
if(waitFunction()) {
window.setTimeout(
function() {
waitForEvent(waitFunction, callback);
}, 1000);
} else {
callback();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment