Created
August 24, 2020 03:34
-
-
Save jessuni/dda4c63fb9c8aa8ae3711ac900bbf9ff to your computer and use it in GitHub Desktop.
extension-section-1-background-2
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.runtime.onConnect.addListener(port => { | |
const tabId = port && port.sender && port.sender.tab.id | |
if (port.name === 'hello') { | |
enableIcon(tabId) | |
} | |
// disable icon when connection is closed | |
port.onDisconnect.addListener(() => { | |
disableIcon(tabId) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment