https://github.com/dy/wait-please
Await interval constructors
https://github.com/dy/wait-please
Last synced: 12 months ago
JSON representation
Await interval constructors
- Host: GitHub
- URL: https://github.com/dy/wait-please
- Owner: dy
- Created: 2019-11-01T14:35:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T03:17:34.000Z (over 3 years ago)
- Last Synced: 2025-05-25T09:41:44.146Z (about 1 year ago)
- Language: JavaScript
- Size: 169 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# wait-please [](https://travis-ci.org/dy/wait-please) [](http://github.com/badges/stability-badges)
Create a promise, waiting for the indicated interval. Useful for organizing tests.
[](https://nodei.co/npm/wait-please/)
```js
import { tick, frame, time, idle } from 'wait-please'
// 3 microtask ticks (queueMicrotask, Promise.resolve ~ same as process.nextTick)
await tick(3)
// 3 animation frames (requestAnimationFrame)
await frame(3)
// 150 ms (setTimeout)
await time(150)
// 1 macrotask in task queue (idle, setImmediate)
await idle()
```
## Similar / refs
* [queue-microtask](https://github.com/feross/queue-microtask)
* [tic-tac](https://www.npmjs.com/package/tic-tac)
HK