0.0.2 • Published 11 years ago

anticipate v0.0.2

Weekly downloads
2
License
-
Repository
github
Last release
11 years ago

anticipate

Retries asynchronous functions until they succeed.

Install

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)

Example (JavaScript)

anticipate = require('anticipate');

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

License

BSD