MCPcopy Create free account
hub / github.com/Noumena-Network/code / waitFor

Function waitFor

src/context/promptOverlayContext.test.tsx:77–88  ·  view source on GitHub ↗
(
  predicate: () => boolean,
  message: string,
  timeoutMs = 500,
)

Source from the content-addressed store, hash-verified

75}
76
77async function waitFor(
78 predicate: () => boolean,
79 message: string,
80 timeoutMs = 500,
81): Promise<void> {
82 const deadline = Date.now() + timeoutMs
83 while (Date.now() < deadline) {
84 if (predicate()) return
85 await Bun.sleep(5)
86 }
87 throw new Error(message)
88}
89
90function DialogWriter({ show }: { show: boolean }): React.ReactNode {
91 const dialog = useMemo(

Callers 1

Calls 1

sleepMethod · 0.80

Tested by

no test coverage detected