My addon opens a popup ( popup.html).
When the user changes the current tab to another tab, the pop-up panel hides until the user clicks on the add-ons icon. (Meanwhile, the addon is still "living" in the background).
When the popup opens a second time, I need to RELOAD its contentURL ( popup.html), but I found a way to do this.
It may look simple, but I have little experience with the Add-on SDK.
Any help would be appreciated.
This is my code:
exports.main = function() {
data = require('self').data;
var tabs = require("tabs");
var popupPanel = require("panel").Panel({
width:550,
height:400,
contentURL: data.url("popup.html"),
contentScriptFile: [data.url("popup.js")],
contentScript: " "+
"self.port.on('curTabMsg', function(curTabMsg) {" +
"main(curTabMsg['curTab']);" +
"});"
});
require('widget').Widget({
panel: popupPanel,
onClick: function() {
popupPanel.port.emit("curTabMsg",{'curTab': tabs.activeTab.url});
}
});
};
source
share