MCPcopy Index your code
hub / github.com/darkreader/darkreader / writeInstallationVersion

Function writeInstallationVersion

src/background/index.ts:242–256  ·  view source on GitHub ↗
(
    storage: chrome.storage.SyncStorageArea | chrome.storage.LocalStorageArea,
    details: chrome.runtime.InstalledDetails,
)

Source from the content-addressed store, hash-verified

240makeChromiumHappy();
241
242function writeInstallationVersion(
243 storage: chrome.storage.SyncStorageArea | chrome.storage.LocalStorageArea,
244 details: chrome.runtime.InstalledDetails,
245) {
246 storage.get<Record<string, any>>({installation: {version: ''}}, (data) => {
247 if (data?.installation?.version) {
248 return;
249 }
250 storage.set({installation: {
251 date: Date.now(),
252 reason: details.reason,
253 version: details.previousVersion ?? chrome.runtime.getManifest().version,
254 }});
255 });
256}
257
258chrome.runtime.onInstalled.addListener((details) => {
259 writeInstallationVersion(chrome.storage.local, details);

Callers 1

index.tsFile · 0.85

Calls 2

getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected