Skip to content

Instantly share code, notes, and snippets.

@cpsubrian
Created May 20, 2013 18:36
Show Gist options
  • Select an option

  • Save cpsubrian/5614268 to your computer and use it in GitHub Desktop.

Select an option

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