Skip to content

Instantly share code, notes, and snippets.

@cpsubrian
Created May 20, 2013 18:36
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cpsubrian/5614268 to your computer and use it in GitHub Desktop.
// Optional `options. Stuff like retry count, ramp-up, etc.
// should have sane defaults.
var wait = waitforit(options, function (cb) {
// This would be the 'test' function.
// cb(true) when 'it' is done.
});
wait.on('ready', function () {
// Do something because the test condition passed.
});
wait.on('timeout', function () {
// We got past the max retries or max total time or w/e.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment