Created
August 11, 2020 18:16
-
-
Save hindmost/fea7e57b90f8c1ee6c9f52e5310de411 to your computer and use it in GitHub Desktop.
cra-rich-chrome-ext article: src/background.js - modifications
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
... | |
chrome.tabs.onActivated.addListener(async data => { | |
const {tabId} = data; | |
if (!tabId) | |
return; | |
const store = await getStore(); | |
const state = store.getState(); | |
const {account, marker} = state; | |
const toMark = account.keywords && marker.enabled; | |
if (!toMark) | |
return; | |
// reset marker stats: | |
store.dispatch(setStats(false)); | |
// pass focus to active tab: | |
chrome.tabs.sendMessage(tabId, {id: 'tabFocusPass'}); | |
}); | |
(async () => { | |
... | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment