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

Method update

packages/chrome-extension-mock/user_scripts.ts:103–113  ·  view source on GitHub ↗
(scripts: any[], callback?: () => void)

Source from the content-addressed store, hash-verified

101 update(scripts: any[]): Promise<void>;
102 update(scripts: any[], callback: () => void): void;
103 update(scripts: any[], callback?: () => void): Promise<void> | void {
104 // console.log("update called with:", scripts);
105 for (const updated of scripts) {
106 const idx = this.scripts.findIndex((s) => s.id === updated.id);
107 if (idx !== -1) {
108 this.scripts[idx] = { ...this.scripts[idx], ...updated };
109 }
110 }
111 if (callback) callback();
112 else return Promise.resolve();
113 }
114
115 // ---- helper for tests ----
116 resetMock(): void {

Callers

nothing calls this directly

Calls 1

callbackFunction · 0.85

Tested by

no test coverage detected