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

Function waitFor

src/ink/inkRecoveryBehavior.test.tsx:105–116  ·  view source on GitHub ↗
(
  predicate: () => boolean,
  message: string,
  timeoutMs = 1500,
)

Source from the content-addressed store, hash-verified

103}
104
105async function waitFor(
106 predicate: () => boolean,
107 message: string,
108 timeoutMs = 1500,
109): Promise<void> {
110 const deadline = Date.now() + timeoutMs
111 while (Date.now() < deadline) {
112 if (predicate()) return
113 await Bun.sleep(10)
114 }
115 throw new Error(message)
116}
117
118function RecoveryHarness(): React.ReactNode {
119 return (

Callers 1

Calls 1

sleepMethod · 0.80

Tested by

no test coverage detected