Skip to content

Instantly share code, notes, and snippets.

@ejschmitt
Created June 11, 2010 00:32
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 ejschmitt/433867 to your computer and use it in GitHub Desktop.
Save ejschmitt/433867 to your computer and use it in GitHub Desktop.
var conditionalLoader = function (condition, execute) {
var interval = setInterval(function () {
if (condition()) {
clearInterval(interval);
execute();
}
}, 50);
};
@ejschmitt
Copy link
Author

Use like:
conditionalLoader(function () { return (myObject.isReady); }, function () {
// stuff to run
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment