MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / readBackgroundScriptState

Function readBackgroundScriptState

e2e/background-script.spec.ts:49–71  ·  view source on GitHub ↗
(page: Page)

Source from the content-addressed store, hash-verified

47};
48
49async function readBackgroundScriptState(page: Page): Promise<BackgroundScriptState | null> {
50 return page.evaluate((scriptName) => {
51 return new Promise((resolve) => {
52 chrome.storage.local.get(null, (all) => {
53 for (const [key, value] of Object.entries(all)) {
54 if (!key.startsWith("script:")) continue;
55 const script = value as any;
56 if (script?.name === scriptName) {
57 resolve({
58 uuid: script.uuid,
59 status: script.status,
60 runStatus: script.runStatus,
61 error: script.error,
62 metadata: script.metadata,
63 });
64 return;
65 }
66 }
67 resolve(null);
68 });
69 });
70 }, SCRIPT_NAME);
71}
72
73async function waitForBackgroundComplete(page: Page): Promise<BackgroundScriptState | null> {
74 const matched = await expect

Callers 1

Calls 2

entriesMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected