Simple Addon: works with jpm run but not after installing the xpi: -
following tutorials made addon working "jpm run" not after installing xpi file. read issue197 thats "icons". addon shown correctly both ways.
but clickevent works "jpm run".
function of addon: clicking in frame.html runs javascript
function frameclick(){ window.parent.postmessage("frame clicked","*"); }
the index.js should open panel.
my code in index.js:
var data = require("sdk/self").data; var mypanel = require("sdk/panel").panel({ contenturl: data.url("panel.html"), contentscriptfile: data.url("panel.js") }); var { frame } = require("sdk/ui/frame"); var frame = new frame({ url: "./frame.html"} ); var { toolbar } = require("sdk/ui/toolbar"); var toolbar = toolbar({ name: "toolbar", title: "toolbar", items: [frame] }); frame.on("message",messagefromframe) function messagefromframe(e){ console.log("messagefromframe: "+e); mypanel.show({position: {top:10,left:10}}); } mypanel.on("show", function() { mypanel.port.emit("show",showfrommypanel); }); function showfrommypanel(e){ console.log("showfrommypanel: "+e); }
the data structure is:
myaddon index.js package.json myaddon/data frame.html frame.js panel.html
any suggestions error? reading :)
Comments
Post a Comment