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

Function evaluate

tooling/scripts/sidebar-vim-smoke.mjs:138–142  ·  view source on GitHub ↗
(client, expression)

Source from the content-addressed store, hash-verified

136 throw new Error(`no CDP page: ${lastErr?.message ?? 'timeout'}`)
137}
138async function evaluate(client, expression) {
139 const r = await client.send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true })
140 if (r.exceptionDetails) throw new Error(r.exceptionDetails.exception?.description ?? r.exceptionDetails.text)
141 return r.result?.value
142}
143/** Poll an evaluated expression until it returns truthy (or time out → null). */
144async function until(client, expression, timeoutMs = 4000, intervalMs = 80) {
145 const deadline = Date.now() + timeoutMs

Callers 4

untilFunction · 0.70
pressKeyFunction · 0.70
cursorStateFunction · 0.70
mainFunction · 0.70

Calls 1

sendMethod · 0.45

Tested by

no test coverage detected