1
제 애드온에서 내 패널의 이미지를 페이지에 배치하고 싶습니다. 모두 정상적으로 작동하지만 새 탭에서 동일하게 만들려고하면 이미지가 이전 탭에도 삽입됩니다. 설명해주십시오. 이전 탭에서 리스너를 제거하려면 어떻게합니까? , the docs for more info를 참조Firefox SDK addon에서 리스너를 제거하는 방법?
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);
}
}
즉, 'worker'를 파괴해야합니까? 이전 탭에서 리스너를 제거하려고하는데 여기 잘못되었습니다. 고마워! –