https://github.com/zweifisch/betolerant
https://github.com/zweifisch/betolerant
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zweifisch/betolerant
- Owner: zweifisch
- Created: 2016-02-14T08:57:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-14T09:08:07.000Z (over 9 years ago)
- Last Synced: 2025-03-01T00:26:56.911Z (3 months ago)
- Language: CoffeeScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# betolerant
[![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]```javascript
let betolerant = require("betolerant");betolerant(3 /*tries*/, 10000 /*timeout*/, function* {
yield asyncOp();
yield sleep(1000);
result = yield checkAsyncOpResult();
if (!result.failed) {
throw Error("op failed");
}
}).then(function(){
// done;
}).catch(function(){
// all three attemps timed out or failed
});
```[npm-image]: https://img.shields.io/npm/v/betolerant.svg?style=flat
[npm-url]: https://npmjs.org/package/betolerant
[travis-image]: https://img.shields.io/travis/zweifisch/betolerant.svg?style=flat
[travis-url]: https://travis-ci.org/zweifisch/betolerant