Skip to content

Commit

Permalink
Update background.js only one blur|focus message
Browse files Browse the repository at this point in the history
  • Loading branch information
raszpl authored Jun 17, 2024
1 parent 670e746 commit 9e76934
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,12 @@ chrome.windows.onFocusChanged.addListener(function (wId) {
windowId = wId;
//console.log('onFocusChanged', windowId, tabPrev, tab);
tabPrune(function () {
if (windowId != tab.windowId && tab.tabId && tabConnected[tab.tabId]) {
if (windowId != tab.windowId && tab.tabId && !tab.blur && tabConnected[tab.tabId]) {
tab.blur = true;
chrome.tabs.sendMessage(tab.tabId, {action: 'blur'});
//console.log('blur', tab.tabId, windowId);
} else if (windowId && tab.tabId && tabConnected[tab.tabId]) {
} else if (windowId == tab.windowId && tab.tabId && tab.blur && tabConnected[tab.tabId]) {
tab.blur = false;
chrome.tabs.sendMessage(tab.tabId, {action: 'focus'});
//console.log('focus', tab.tabId, windowId);
}
Expand Down

0 comments on commit 9e76934

Please sign in to comment.