(
url: string,
_storetype?: StoreType,
signal?: AbortSignal,
)
| 718 | } |
| 719 | |
| 720 | async addToCache( |
| 721 | url: string, |
| 722 | _storetype?: StoreType, |
| 723 | signal?: AbortSignal, |
| 724 | ): Promise<void> { |
| 725 | const existing = await this.storage.match(url); |
| 726 | if (existing !== undefined) { |
| 727 | return; |
| 728 | } |
| 729 | const request = new Request( |
| 730 | url, |
| 731 | signal ? { ...DEFAULT_FETCH_OPTIONS, signal } : DEFAULT_FETCH_OPTIONS, |
| 732 | ); |
| 733 | const response = await fetch(request); |
| 734 | if (!response.ok) { |
| 735 | throw new Error( |
| 736 | `ArtifactCrossOriginStorageCache: Unable to fetch ${url}, received status ${response.status}`, |
| 737 | ); |
| 738 | } |
| 739 | await this.storage.put(url, response.clone()); |
| 740 | } |
| 741 | |
| 742 | async hasAllKeys(keys: string[]): Promise<boolean> { |
| 743 | const results = await Promise.all( |
no test coverage detected