refactor: Replace Webpack with Vite (#53)
This commit is contained in:
8
src/pages/background/events/onInstall.ts
Normal file
8
src/pages/background/events/onInstall.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { ExtensionStore } from '@shared/storage/ExtensionStore';
|
||||
|
||||
/**
|
||||
* Called when the extension is first installed or synced onto a new machine
|
||||
*/
|
||||
export default async function onInstall() {
|
||||
await ExtensionStore.set('version', chrome.runtime.getManifest().version);
|
||||
}
|
||||
9
src/pages/background/events/onServiceWorkerAlive.ts
Normal file
9
src/pages/background/events/onServiceWorkerAlive.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { openDebugTab } from '../util/openDebugTab';
|
||||
|
||||
/**
|
||||
* Called whenever the background service worker comes alive
|
||||
* (usually around 30 seconds to 5 minutes after it was last alive)
|
||||
*/
|
||||
export default function onServiceWorkerAlive() {
|
||||
openDebugTab();
|
||||
}
|
||||
11
src/pages/background/events/onUpdate.ts
Normal file
11
src/pages/background/events/onUpdate.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { ExtensionStore } from '@shared/storage/ExtensionStore';
|
||||
|
||||
/**
|
||||
* Called when the extension is updated (or when the extension is reloaded in development mode)
|
||||
*/
|
||||
export default async function onUpdate() {
|
||||
await ExtensionStore.set({
|
||||
version: chrome.runtime.getManifest().version,
|
||||
lastUpdate: Date.now(),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user