()
| 375 | |
| 376 | // store cache |
| 377 | persistCache() { |
| 378 | const data = JSON.stringify(this.cache, null, 2); |
| 379 | if (isQX) $prefs.setValueForKey(data, this.name); |
| 380 | if (isLoon || isSurge) $persistentStore.write(data, this.name); |
| 381 | if (isNode) { |
| 382 | this.node.fs.writeFileSync( |
| 383 | `${this.name}.json`, |
| 384 | data, |
| 385 | { |
| 386 | flag: "w", |
| 387 | }, |
| 388 | (err) => console.log(err) |
| 389 | ); |
| 390 | this.node.fs.writeFileSync( |
| 391 | "root.json", |
| 392 | JSON.stringify(this.root, null, 2), |
| 393 | { |
| 394 | flag: "w", |
| 395 | }, |
| 396 | (err) => console.log(err) |
| 397 | ); |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | write(data, key) { |
| 402 | this.log(`SET ${key}`); |
no test coverage detected