retries asynchronous functions until they succeed
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
spec
src
test
.gitignore
README.md
package.json

README.md

anticipate

Retries asynchronous functions until they succeed.

Install

npm install anticipate

Example (PogoScript)

anticipate = require 'anticipate'

anticipate.trying @(callback)
    something unreliable (callback)
every 0.1 seconds for 3 tries @(result)
    it worked (result)
else @(error)
    oh noes (error)

Example (JavaScript)

anticipate = require('anticipate');

anticipate.tryingEverySecondsForTriesElse(function(callback) {
    somethingUnreliable(callback);
}, 0.1, 3, function(result) {
    itWorked(result);
}, function(error) {
    ohNoes(error);
});

License

BSD