MCPcopy Index your code
hub / github.com/EmulatorJS/EmulatorJS / addFileToDB

Method addFileToDB

data/src/storage.js:6–19  ·  view source on GitHub ↗
(key, add)

Source from the content-addressed store, hash-verified

4 this.storeName = storeName;
5 }
6 addFileToDB(key, add) {
7 (async () => {
8 if (key === "?EJS_KEYS!") return;
9 let keys = await this.get("?EJS_KEYS!");
10 if (!keys) keys = [];
11 if (add) {
12 if (!keys.includes(key)) keys.push(key);
13 } else {
14 const index = keys.indexOf(key);
15 if (index !== -1) keys.splice(index, 1);
16 }
17 this.put("?EJS_KEYS!", keys);
18 })();
19 }
20 get(key) {
21 return new Promise((resolve, reject) => {
22 if (!window.indexedDB) return resolve();

Callers 2

putMethod · 0.95
removeMethod · 0.95

Calls 2

getMethod · 0.95
putMethod · 0.95

Tested by

no test coverage detected