anticipate
v0.0.2
Published
retries asynchronous functions until they succeed
Downloads
5
Readme
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