MCPcopy
hub / github.com/tldraw/tldraw / waitFor

Function waitFor

apps/dotcom/client/scripts/kill-tree.test.ts:42–49  ·  view source on GitHub ↗
(predicate: () => boolean, timeoutMs = 5000)

Source from the content-addressed store, hash-verified

40}
41
42async function waitFor(predicate: () => boolean, timeoutMs = 5000) {
43 const deadline = Date.now() + timeoutMs
44 while (Date.now() < deadline) {
45 if (predicate()) return
46 await new Promise((r) => setTimeout(r, 25))
47 }
48 throw new Error('timed out waiting for condition')
49}
50
51function recordedPids() {
52 try {

Callers 1

kill-tree.test.tsFile · 0.70

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…