MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / pageTargetCount

Function pageTargetCount

e2e/desktop-vm/artifact-external-link.test.ts:90–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88
89/** How many pages the app has open right now — a new in-app window bumps this. */
90const pageTargetCount = async (): Promise<number> => {
91 const targets = (await fetch(`http://127.0.0.1:${cdpPort}/json/list`)
92 .then((r) => (r.ok ? r.json() : []))
93 .catch(() => [])) as ReadonlyArray<{ type: string }>;
94 return targets.filter((t) => t.type === "page").length;
95};
96
97const run = async (runDir: string) => {
98 const cdp = await CdpPage.connect(await pageWsUrl(Number(cdpPort)));

Callers 1

runFunction · 0.85

Calls 2

jsonMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected