Skip to content

Commit

Permalink
Update: toggle popup
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayao0819 committed Nov 24, 2023
1 parent 86df2ae commit bf6cd31
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/scripts/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import browser from "webextension-polyfill";
import StorageTool from "@/class/StorageTool";
import isTrue from "@/utils/isTrue";
import OpenOptions from "@/utils/openOptions";
import { disablePopup, enablePopup } from "@/utils/popupControl";

browser.runtime.onInstalled.addListener(async () => {
const storage = new StorageTool("other");
Expand All @@ -15,5 +16,12 @@ browser.runtime.onInstalled.addListener(async () => {
});

browser.storage.onChanged.addListener((change) => {
console.log(change);
if (Object.keys(change).includes("other")) {
const quickSwitchEnabled = isTrue(change.other.newValue["quick-switch"]);
if (quickSwitchEnabled) {
disablePopup();
} else {
enablePopup();
}
}
});

0 comments on commit bf6cd31

Please sign in to comment.