Skip to content

Commit

Permalink
fix: sync storage restore after chrome update (#282)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Bastin <[email protected]>
  • Loading branch information
JackAdd91 and AndrewBastin authored Mar 14, 2024
1 parent cd0c379 commit 91c6150
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,16 @@ chrome.tabs.onUpdated.addListener((_id, _info, tab) => {
})

chrome.runtime.onInstalled.addListener(() => {
chrome.storage.sync.set(
{
originList: JSON.stringify(DEFAULT_ORIGIN_LIST),
},
() => {}
)
chrome.storage.sync.get((items) => {
if (!items.originList) {
chrome.storage.sync.set(
{
originList: JSON.stringify(DEFAULT_ORIGIN_LIST),
},
() => {}
)
}
})
})

chrome.runtime.onMessage.addListener((message, sender) => {
Expand Down

0 comments on commit 91c6150

Please sign in to comment.