| 240 | makeChromiumHappy(); |
| 241 | |
| 242 | function 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 | |
| 258 | chrome.runtime.onInstalled.addListener((details) => { |
| 259 | writeInstallationVersion(chrome.storage.local, details); |