https://github.com/seeden/fast-wait
Delay a promise a specified amount of time. Always fast as possible.
https://github.com/seeden/fast-wait
async await javascript settimeout
Last synced: about 1 year ago
JSON representation
Delay a promise a specified amount of time. Always fast as possible.
- Host: GitHub
- URL: https://github.com/seeden/fast-wait
- Owner: seeden
- License: mit
- Created: 2018-03-27T11:56:52.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-27T14:19:56.000Z (almost 8 years ago)
- Last Synced: 2025-03-17T01:35:10.557Z (about 1 year ago)
- Topics: async, await, javascript, settimeout
- Language: JavaScript
- Size: 13.7 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fast-wait
Delay a promise a specified amount of time. Always fast as possible.
For empty delay it will try to resolve fast as possible. For delay > 0 it will use standard setTimeout
[![NPM version][npm-image]][npm-url]
[npm-image]: https://img.shields.io/npm/v/fast-wait.svg?style=flat-square
[npm-url]: https://www.npmjs.com/fast-wait
[travis-image]: https://img.shields.io/travis/seeden/fast-wait/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/seeden/fast-wait
[coveralls-image]: https://img.shields.io/coveralls/seeden/fast-wait/master.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/seeden/fast-wait?branch=master
[github-url]: https://github.com/seeden/fast-wait
## Usage
```js
import wait from 'fast-wait';
async function test() {
await wait(); // it will use Promise#then
await wait(200); // it will use setTimeout
}
test();
```
## Performance
```sh
fast-wait x 10000 = 52ms
setTimeout x 10000 = 12957ms
```
# Support us
Star this project on [GitHub][github-url].
## Credits
[Zlatko Fedor](http://github.com/seeden)