mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
fix: storage always resetting to default
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
initializeSettingsState,
|
||||||
settingsState,
|
settingsState,
|
||||||
} from "@/seqta/utils/listeners/SettingsState"
|
} from "@/seqta/utils/listeners/SettingsState"
|
||||||
import documentLoadCSS from "@/css/documentload.scss?inline"
|
import documentLoadCSS from "@/css/documentload.scss?inline"
|
||||||
@@ -38,6 +39,8 @@ async function init() {
|
|||||||
icon.href = icon48 // Change the icon
|
icon.href = icon48 // Change the icon
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await initializeSettingsState()
|
||||||
|
|
||||||
if (typeof settingsState.onoff === "undefined") {
|
if (typeof settingsState.onoff === "undefined") {
|
||||||
browser.runtime.sendMessage({ type: "setDefaultStorage" })
|
browser.runtime.sendMessage({ type: "setDefaultStorage" })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import browser from "webextension-polyfill"
|
|||||||
|
|
||||||
// Internal utilities and functions
|
// Internal utilities and functions
|
||||||
import {
|
import {
|
||||||
initializeSettingsState,
|
|
||||||
settingsState,
|
settingsState,
|
||||||
} from "@/seqta/utils/listeners/SettingsState"
|
} from "@/seqta/utils/listeners/SettingsState"
|
||||||
|
|
||||||
@@ -16,8 +15,6 @@ import injectedCSS from "@/css/injected.scss?inline"
|
|||||||
export async function main() {
|
export async function main() {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
await initializeSettingsState()
|
|
||||||
|
|
||||||
if (settingsState.onoff) {
|
if (settingsState.onoff) {
|
||||||
injectPageState()
|
injectPageState()
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,9 @@ class StorageManager {
|
|||||||
|
|
||||||
private async loadFromStorage(): Promise<void> {
|
private async loadFromStorage(): Promise<void> {
|
||||||
const result = await browser.storage.local.get();
|
const result = await browser.storage.local.get();
|
||||||
this.data = { ...this.data, ...result };
|
Object.entries(result).forEach(([key, value]) => {
|
||||||
|
Reflect.set(this.data, key, value);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async saveToStorage(): Promise<void> {
|
private async saveToStorage(): Promise<void> {
|
||||||
|
|||||||
Reference in New Issue
Block a user