Fix storage issue causing popup to be blank

main
Elbert Alias 2 years ago
parent 4f001516d3
commit deadefbcc9

@ -5,13 +5,6 @@
// Manifest v2 polyfill // Manifest v2 polyfill
if (chrome.runtime.getManifest().manifest_version === 2) { if (chrome.runtime.getManifest().manifest_version === 2) {
chrome.action = chrome.browserAction chrome.action = chrome.browserAction
chrome.storage.sync = {
get: (...args) =>
new Promise((resolve) => chrome.storage.local.get(...args, resolve)),
set: (...args) =>
new Promise((resolve) => chrome.storage.local.set(...args, resolve)),
}
} }
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
@ -56,7 +49,7 @@ const Utils = {
*/ */
async getOption(name, defaultValue = null) { async getOption(name, defaultValue = null) {
try { try {
const option = await chrome.storage.sync.get(name) const option = await chrome.storage.local.get(name)
if (option[name] !== undefined) { if (option[name] !== undefined) {
return option[name] return option[name]
@ -76,7 +69,7 @@ const Utils = {
*/ */
async setOption(name, value) { async setOption(name, value) {
try { try {
await chrome.storage.sync.set({ await chrome.storage.local.set({
[name]: value, [name]: value,
}) })
} catch (error) { } catch (error) {