安装
npm install wait-please
yarn add wait-please
pnpm add wait-please
bun add wait-please
README

wait-please Build Status unstable

Create a promise, waiting for the indicated interval. Useful for organizing tests.

NPM

import { time, 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

HK

版本列表
3.1.0 2020-04-27
3.0.0 2019-12-18
2.0.1 2019-12-04
2.0.0 2019-12-04
1.1.0 2019-11-01
1.0.0 2019-11-01