Search code examples
javascriptfirefox-addonfirefox-addon-sdk

How emit function in firefox extension?


Can i emit function from one file to another in firefox extension? Example:

main.js

data = function() {
   return fn();
}

panel.port.emit("resp", data);

panel.js

self.port.on('resp', function(fn) {
   return fn("some");
});

Solution

  • The port API only supports JSON-serializeable data.