MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / getWatchListCache

Function getWatchListCache

src/modules/prefs.js:70–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68// addListener for event-page wakeup). Any cold path reloads — addListener
69// after a macrotask would miss the queued wakeup event.
70export async function getWatchListCache() {
71 const cached = localStorage.getItem('mvelo.watchlist.cache');
72 if (cached) {
73 return JSON.parse(cached);
74 }
75 // Cold path: ensure the cache is populated so the next init's warm path hits.
76 await defaultsInitialized;
77 if (!localStorage.getItem('mvelo.watchlist.cache')) {
78 const watchList = await mvelo.storage.get('mvelo.watchlist');
79 if (watchList) {
80 localStorage.setItem('mvelo.watchlist.cache', JSON.stringify(watchList));
81 }
82 }
83 window.location.reload();
84 await new Promise(() => {}); // page is reloading
85}
86
87export async function setWatchList(watchList) {
88 await mvelo.storage.set('mvelo.watchlist', watchList);

Callers 1

initScriptInjectionFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected