Files
reacord/packages/helpers/wait-for.ts
MapleLeaf e709e3acb5 monorepo
2021-12-16 11:48:18 -06:00

9 lines
235 B
TypeScript

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)
}
}