MCPcopy
hub / github.com/darkreader/darkreader / readImageDetailsCache

Function readImageDetailsCache

src/inject/cache.ts:57–73  ·  view source on GitHub ↗
(targetMap: Map<string, ImageDetails>)

Source from the content-addressed store, hash-verified

55}
56
57export 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
75export function writeCSSFetchCache(url: string, cssText: string): void {
76 const key = `${STORAGE_KEY_CSS_FETCH_PREFIX}${url}`;

Callers 1

getURLModifierFunction · 0.90

Calls 1

setMethod · 0.65

Tested by

no test coverage detected