0
這是我想要的偏好設置:無法設置BOOL簡單 - 首選項
{
"name": "datestamp",
"title": "Date stamp?",
"type": "bool",
"value": true
}
繼承人的插件代碼,
preference.js
var preference = require("simple-prefs");
exports.set = function(preferenceTemp, value){
console.log(value);
preference.prefs[preferenceTemp] = value;
}
main.js
Preference = require("./Preference")
Preference.set('datestamp', true);
呃ror在控制檯上試圖執行時:
console.error: addon:
Message: [Exception... "Component returned failure code: 0x8000ffff
(NS_ERROR_UNEXPECTED) [nsIPrefBranch.setComplexValue]" nsresult: "0x8000ffff
(NS_ERROR_UNEXPECTED)" location: "JS frame :: resource://gre/modules/XPIProvider.jsm
-> jar:file:///tmp/tmpuc82Vi.mozrunner/extensions
/[email protected]!/bootstrap.js -> resource://gre/modules/commonjs/toolkit
/loader.js -> resource://gre/modules/commonjs/sdk/preferences/service.js :: set ::
line 92" data: no]
您的代碼工作正常,我 - 該SDK的哪些版本和Firefox您使用的? – canuckistani
'附加SDK 1.14(39467a307f58b63c1907c8d383e48475c98b0624)' – bobbyrne01