Skip to content

Instantly share code, notes, and snippets.

@PAEz
Created December 13, 2012 16:26
Show Gist options
  • Save PAEz/4277638 to your computer and use it in GitHub Desktop.
Save PAEz/4277638 to your computer and use it in GitHub Desktop.
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);
});
}
});
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