White it isn't obvious from the documentation, but simple-prefs.prefs
is actually a Branch
, which in turn is a full Javascript proxy around the underlying XPCOM preference service.
So it is possible to just set any preference to a Number
(Integer
), Boolean
or String
, e.g.
const {prefs} = require("simple-prefs");
console.log("before", prefs.pref1, prefs["pref2"]);
prefs.pref1 = "some string";
prefs["pref2"] = 2;
console.log("after", prefs.pref1, prefs["pref2"]);