https://github.com/magicdawn/promise.sleep
promise.sleep
https://github.com/magicdawn/promise.sleep
Last synced: 6 months ago
JSON representation
promise.sleep
- Host: GitHub
- URL: https://github.com/magicdawn/promise.sleep
- Owner: magicdawn
- License: mit
- Created: 2016-05-13T10:50:34.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-08T23:53:44.000Z (about 9 years ago)
- Last Synced: 2025-09-25T21:48:40.274Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# promise.sleep
> promise.sleep
[](https://travis-ci.org/magicdawn/promise.sleep)
[](https://codecov.io/gh/magicdawn/promise.sleep)
[](https://www.npmjs.com/package/promise.sleep)
[](https://www.npmjs.com/package/promise.sleep)
[](http://magicdawn.mit-license.org)
## Install
```
npm i promise.sleep --save
```
## API
### `sleep`
```js
const sleep = require('promise.sleep');
sleep(100).then(function(){
// blabla
});
```
### `sleep.Green`
```js
const Green = require('promise.sleep').Green;
const green = new Green({
min: '1m',
max: '10m',
factor: '1m',
});
```
- `green.idle()` sleep a while
- `green.busy()` / `green.reset()` reset to `min`
## Changelog
[CHANGELOG.md](CHANGELOG.md)
## See Also
- [promise.timeout](https://github.com/magicdawn/promise.timeout)
- [promise.retry](https://github.com/magicdawn/promise.retry)
- [promise.map](https://github.com/magicdawn/promise.map)
- [promise.ify](https://github.com/magicdawn/promise.ify)
- [promise.cb](https://github.com/magicdawn/promise.cb)
- [promise.obj](https://github.com/magicdawn/promise.obj)
- [promise.sleep](https://github.com/magicdawn/promise.sleep)
## License
the MIT License http://magicdawn.mit-license.org