Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
extension-section-1-background-2
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
You can’t perform that action at this time.