Transfer local storage to sync storage on new installs.
This commit is contained in:
parent
fe06822b24
commit
ed29853516
|
@ -16,6 +16,16 @@ browser.runtime.onInstalled.addListener(async () => {
|
||||||
if (import.meta.env.DEV) {
|
if (import.meta.env.DEV) {
|
||||||
await browser.runtime.openOptionsPage();
|
await browser.runtime.openOptionsPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const {dataVersion} = await browser.storage.sync.get({
|
||||||
|
dataVersion: '0',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (dataVersion === '0') {
|
||||||
|
const local = await browser.storage.local.get();
|
||||||
|
local.dataVersion = '1';
|
||||||
|
await browser.storage.sync.set(local);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
browser.webNavigation.onBeforeNavigate.addListener(async (details) => {
|
browser.webNavigation.onBeforeNavigate.addListener(async (details) => {
|
||||||
|
|
Loading…
Reference in New Issue