| 31 | const cachedImageUrls: string[] = []; |
| 32 | |
| 33 | function writeImageDetailsQueue() { |
| 34 | imageDetailsCacheQueue.forEach((details, url) => { |
| 35 | if (url && url.startsWith('https://')) { |
| 36 | try { |
| 37 | const json = JSON.stringify(details); |
| 38 | sessionStorage.setItem(`${STORAGE_KEY_IMAGE_DETAILS_PREFIX}${url}`, json); |
| 39 | cachedImageUrls.push(url); |
| 40 | } catch (err) { |
| 41 | } |
| 42 | } |
| 43 | }); |
| 44 | imageDetailsCacheQueue.clear(); |
| 45 | sessionStorage.setItem(STORAGE_KEY_IMAGE_DETAILS_LIST, JSON.stringify(cachedImageUrls)); |
| 46 | } |
| 47 | |
| 48 | export function writeImageDetailsCache(url: string, imageDetails: ImageDetails): void { |
| 49 | if (!url || !url.startsWith('https://')) { |