Created
December 13, 2012 16:26
-
-
Save PAEz/4277638 to your computer and use it in GitHub Desktop.
Browser Action Toggle
https://plus.google.com/u/0/114182909067816580108/posts/gqTjknY4Bs6
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.browserAction.setPopup({ | |
popup: "popup.html" | |
}) | |
chrome.browserAction.onClicked.addListener(function() { | |
chrome.browserAction.setPopup({ | |
popup: "popup.html" | |
}) | |
}); | |
chrome.extension.onConnect.addListener(function(port) { | |
if(port.name == "popuptoggle") { | |
chrome.browserAction.setPopup({ | |
popup: "" | |
}); | |
port.onDisconnect.addListener(function(a) { | |
setTimeout(function() { | |
chrome.browserAction.setPopup({ | |
popup: "popup.html" | |
}) | |
}, 100); | |
}); | |
} | |
}); |
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
var port = chrome.extension.connect({name: "popuptoggle"}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment