monorepo
This commit is contained in:
8
packages/helpers/wait-for.ts
Normal file
8
packages/helpers/wait-for.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { setTimeout } from "node:timers/promises"
|
||||
import type { MaybePromise } from "./types.js"
|
||||
|
||||
export async function waitFor(condition: () => MaybePromise<boolean>) {
|
||||
while (!(await condition())) {
|
||||
await setTimeout(100)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user