anticipate

retries asynchronous functions until they succeed

anticipate

Retries asynchronous functions until they succeed.

npm install anticipate

Example (PogoScript)

anticipate = require 'anticipate'

anticipate.trying @(callback) every 0.1 seconds
    something flaky with (callback)
.succeeds within 10 tries @(result)
    it worked (result)
.otherwise @(error)
    oh noes (error)
anticipate = require('anticipate');

anticipate.tryingEverySeconds(function(callback) {
    somethingFlakyWith(callback);
}, 0.1).succeedsWithinTries(10, function(result) {
    itWorked(result);
}).otherwise(function(error) {
    ohNoes(error);
});

BSD