(key, add)
| 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(); |