문제

Is it possible to update a firefox addon's preferences programmatically?

Given the following:

const prefs = require("sdk/simple-prefs");
prefs.stringPreference = "some random string";

It seems that my update to stringPreference doesn't get persisted, and will revert back to the value in about:addons when reloaded, new tabs are opened, etc.

Is this possible? The docs imply changes are saved automatically but this doesn't seem to be the case..

도움이 되었습니까?

해결책

You have missed the .prefs attribute. It should be:

var prefs = require("sdk/simple-prefs").prefs;

Notice the .prefs at the end of the line.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top