fix: only handle in active tab

This commit is contained in:
DIYgod
2019-07-18 01:02:51 +08:00
parent 8f0b814741
commit e347a20ff6
+5 -1
View File
@@ -10,6 +10,10 @@ function handlePageRSS (feeds) {
}
}
chrome.browserAction.setBadgeBackgroundColor({
color: '#FF2800',
});
chrome.tabs.onActivated.addListener(function (tab) {
chrome.tabs.sendMessage(tab.tabId, {
text: 'getPageRSS',
@@ -17,7 +21,7 @@ chrome.tabs.onActivated.addListener(function (tab) {
});
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
if (msg.text === 'setPageRSS') {
if (msg.text === 'setPageRSS' && sender.tab.active) {
handlePageRSS(msg.feeds);
}
});