| 55 | } |
| 56 | |
| 57 | export function readImageDetailsCache(targetMap: Map<string, ImageDetails>): void { |
| 58 | try { |
| 59 | const jsonList = sessionStorage.getItem(STORAGE_KEY_IMAGE_DETAILS_LIST); |
| 60 | if (!jsonList) { |
| 61 | return; |
| 62 | } |
| 63 | const list: string[] = JSON.parse(jsonList); |
| 64 | list.forEach((url) => { |
| 65 | const json = sessionStorage.getItem(`${STORAGE_KEY_IMAGE_DETAILS_PREFIX}${url}`); |
| 66 | if (json) { |
| 67 | const details = JSON.parse(json); |
| 68 | targetMap.set(url, details); |
| 69 | } |
| 70 | }); |
| 71 | } catch (err) { |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | export function writeCSSFetchCache(url: string, cssText: string): void { |
| 76 | const key = `${STORAGE_KEY_CSS_FETCH_PREFIX}${url}`; |