-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update storage data when switching page or updating url
- Loading branch information
1 parent
e54ee80
commit af77b2b
Showing
3 changed files
with
37 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
chrome.action.onClicked.addListener(tab => { | ||
if (tab.id) { | ||
chrome.tabs.sendMessage(tab.id, { toggleVisible: true }); | ||
} | ||
// trigger then clicking the extension logo | ||
chrome.action.onClicked.addListener((tab) => { | ||
if (tab.id) { | ||
chrome.tabs.sendMessage(tab.id, { toggleVisible: true }); | ||
} | ||
}); | ||
|
||
// trigger when active tab switches | ||
chrome.tabs.onActivated.addListener(function(activeInfo) { | ||
if (activeInfo?.tabId) { | ||
chrome.tabs.sendMessage(activeInfo?.tabId, { updateStorage: true }); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters