MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / waitForExpression

Function waitForExpression

tooling/scripts/perf-web-runtime.mjs:429–442  ·  view source on GitHub ↗
(client, expression, timeoutMs, label)

Source from the content-addressed store, hash-verified

427}
428
429async function waitForExpression(client, expression, timeoutMs, label) {
430 const deadline = Date.now() + timeoutMs
431 let lastError = null
432 while (Date.now() < deadline) {
433 try {
434 const value = await evaluate(client, expression)
435 if (value) return value
436 } catch (err) {
437 lastError = err
438 }
439 await sleep(50)
440 }
441 throw new Error(`Timed out waiting for ${label}: ${lastError?.message ?? 'condition not met'}`)
442}
443
444async function prepareWebDist() {
445 if (!skipWebBuild || !(await fileExists(webDistIndex))) {

Callers 1

mainFunction · 0.70

Calls 2

evaluateFunction · 0.70
sleepFunction · 0.70

Tested by

no test coverage detected