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

Function waitForExpression

tooling/scripts/perf-desktop-runtime.mjs:406–419  ·  view source on GitHub ↗
(client, expression, timeoutMs, label)

Source from the content-addressed store, hash-verified

404}
405
406async function waitForExpression(client, expression, timeoutMs, label) {
407 const deadline = Date.now() + timeoutMs
408 let lastError = null
409 while (Date.now() < deadline) {
410 try {
411 const value = await evaluate(client, expression)
412 if (value) return value
413 } catch (err) {
414 lastError = err
415 }
416 await sleep(50)
417 }
418 throw new Error(`Timed out waiting for ${label}: ${lastError?.message ?? 'condition not met'}`)
419}
420
421function parseMainPerfSamples(log) {
422 const samples = []

Callers 1

mainFunction · 0.70

Calls 2

evaluateFunction · 0.70
sleepFunction · 0.70

Tested by

no test coverage detected