(url: string, storetype?: string, signal?: AbortSignal)
| 490 | } |
| 491 | |
| 492 | async fetchWithCache(url: string, storetype?: string, signal?: AbortSignal): Promise<any> { |
| 493 | await this.addToCache(url, storetype, signal); |
| 494 | let result = await this.asyncGetHelper(url); |
| 495 | if (result === null) { |
| 496 | // previously null data in cache or somehow failed to add to cache, delete and retry |
| 497 | await this.deleteInCache(url); |
| 498 | await this.addToCache(url, storetype); |
| 499 | result = await this.asyncGetHelper(url); |
| 500 | } |
| 501 | if (result != null && typeof result === "object" && "data" in result) { |
| 502 | // `storetype` not used here because the data stored in indexedDB is already in that type |
| 503 | return result.data; |
| 504 | } |
| 505 | throw Error("ArtifactIndexedDBCache failed to fetch: " + url); |
| 506 | } |
| 507 | |
| 508 | async addToIndexedDB(url: string, response: any, storetype?: string) { |
| 509 | await this.initDB(); |
nothing calls this directly
no test coverage detected