MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / waitForValue

Function waitForValue

scripts/e2e-webrtc-reliability.mjs:886–898  ·  view source on GitHub ↗
(cdp, expression, predicate, timeoutMs)

Source from the content-addressed store, hash-verified

884}
885
886async function waitForValue(cdp, expression, predicate, timeoutMs) {
887 const startedAt = Date.now();
888 while (Date.now() - startedAt < timeoutMs) {
889 const value = await evaluate(cdp, expression);
890 if (predicate(value)) {
891 return value;
892 }
893 await sleep(250);
894 }
895 throw new Error(
896 `Timed out waiting for expression: ${expression}\n${chromeOutput}`,
897 );
898}
899
900async function collectReadinessDiagnostics(cdp, clientId) {
901 const page = await evaluate(

Callers 1

Calls 2

evaluateFunction · 0.85
sleepFunction · 0.70

Tested by

no test coverage detected