refactor(storage): use `storage.session` instead of `storage.local`

This commit is contained in:
Thomas Rupprecht 2023-09-06 20:10:55 +02:00
parent 918cf7db91
commit db0faab4db
3 changed files with 4 additions and 8 deletions

View File

@ -9,10 +9,6 @@ browser.runtime.onInstalled.addListener(async (details) => {
}
});
browser.runtime.onStartup.addListener(async () => {
await browser.storage.local.remove(['calendar', 'spaceApi']);
});
browser.alarms.onAlarm.addListener((alarm) => {
if (alarm.name === 'fetchData') {
fetchNewData();
@ -68,13 +64,13 @@ async function fetchNewData() {
/**
* @type {import("../types").Storage}
*/
const { spaceApi } = await browser.storage.local.get('spaceApi');
const { spaceApi } = await browser.storage.session.get('spaceApi');
if (spaceApi && spaceApi.state.open !== spaceApiJson.state.open) {
await createStatusChangedNotification(spaceApiJson.state.open);
}
}
await browser.storage.local.set({
await browser.storage.session.set({
calendar: calendarJson,
spaceApi: spaceApiJson,
});

View File

@ -28,7 +28,7 @@
"browser_specific_settings": {
"gecko": {
"id": "{c9a907ad-a047-4cf6-8b5d-95097d31aa5b}",
"strict_min_version": "112.0"
"strict_min_version": "115.0"
}
}
}

View File

@ -57,7 +57,7 @@ async function init() {
/**
* @type {import("../types").Storage}
*/
const { calendar, spaceApi } = await browser.storage.local.get(['calendar', 'spaceApi']);
const { calendar, spaceApi } = await browser.storage.session.get(['calendar', 'spaceApi']);
if (calendar) {
updateNextEvent(calendar);