I am developing a new version of my add-on (Gmail targeting) using the SDK and you will need to save some logical settings for my users. For this, I would like to play with the new "simple prefs" API. Based on the Mozilla documentation and this question, https://stackoverflow.com/a/166269/232632 , I have something, but I am facing the following problems:
1) I can not force the changes in my settings to correctly transmit my external script data. I need to disable and enable the add-in again in order to apply the changes.
2) How to ensure that the settings are directly applied to the tab in which Gmail opens.
Here is my package.json:
{ "name": "Demo", "license": "MPL 1.1/GPL 2.0/LGPL 2.1", "author": "me", ... "preferences": [{ "type": "bool", "name": "option1", "value": true, "title": "Description Option1" }, { "type": "bool", "name": "option2", "value": true, "title": "Description Option2" }] }
My main.js:
const pageMod = require("page-mod"); const data = require("self").data; const prefSet = require("simple-prefs");
My script.js (in data):
(function(){
There is, of course, an easier way to use the postMessage protocol in my main.js file and invoke it in the script.js file ... Feel free to offer your ideas and suggestions!
firefox-addon firefox-addon-sdk
flo
source share