doc: Fix bad extension API examples (#608)

This commit is contained in:
couriourc
2024-04-12 14:01:07 +08:00
committed by GitHub
parent 2a4fa9ae5c
commit c09994263e
+2 -2
View File
@@ -39,9 +39,9 @@ Then we can use `browser.storage` to save the install date to local storage.
```ts
// background.ts
export default defineBackground(() => {
browser.runtime.onInstall.addEventListener(({ reason }) => {
browser.runtime.onInstalled.addListener(({ reason }) => {
if (reason === 'install') {
browser.storage.local.setItem({ installDate: Date.now() });
browser.storage.local.set({ installDate: Date.now() });
}
});
});