1
在我的插件中,我想從我的面板圖像到頁面。所有的工作都很好,但是當我嘗試在新標籤中製作相同的圖片時,也會在舊標籤中插入圖片。請解釋我,我如何從舊標籤中刪除監聽器?如何刪除Firefox SDK插件中的監聽器?
var tabIs;
var thisTab;
tabs.on("ready", function(tab) {
tabIs = tab.id;
tab.on("load", function(tab) {
tabIs += 1;
});
});
function handleClick() {
function insertPic(pic) {
var abs_url = self.data.url(pic);
worker.port.emit("to-page", abs_url);
}
if (thisTab == tabIs) {
panel.show();
panel.port.on("from-panel", insertPic);
} else {
thisTab = tabIs;
panel.show();
var worker = tabs.activeTab.attach({
contentScriptFile: [self.data.url("jquery-2.1.1.min.js"), self.data.url("page.js")]
});
panel.port.on("from-panel", insertPic);
}
}
也就是說,我需要摧毀'工人'?我試圖從舊標籤中刪除監聽器,在這裏我錯了。謝謝! – 2014-11-06 14:20:48