MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / waitFor

Function waitFor

tests/e2e/smoke/chart-runtime.smoke.test.js:286–302  ·  view source on GitHub ↗
(fn, timeoutMs, label)

Source from the content-addressed store, hash-verified

284}
285
286async function waitFor(fn, timeoutMs, label) {
287 const start = Date.now()
288 let lastError = null
289
290 while (Date.now() - start < timeoutMs) {
291 try {
292 const result = await fn()
293 if (result) return result
294 } catch (error) {
295 lastError = error
296 }
297 await new Promise((resolve) => setTimeout(resolve, 200))
298 }
299
300 const suffix = lastError ? ` Last error: ${lastError.message}` : ''
301 throw new Error(`${label} not ready within ${timeoutMs}ms.${suffix}`)
302}
303
304async function getRendererDebuggerUrl(port) {
305 return waitFor(

Callers 2

getRendererDebuggerUrlFunction · 0.85

Calls 2

setTimeoutFunction · 0.85
nowMethod · 0.45

Tested by

no test coverage detected