PrefManager Prototype
Syntax
var object = new PrefManager(branchName, defaultBundle);
Arguments
Argument | Summary |
---|---|
branchName | |
defaultBundle |
Remarks
Members
See Also
Source Code
function PrefManager (branchName, defaultBundle)
{
var prefManager = this;
function pm_observe (prefService, topic, prefName)
{
prefManager.onPrefChanged(prefName);
};
const PREF_CTRID = "@mozilla.org/preferences-service;1";
const nsIPrefService = Components.interfaces.nsIPrefService;
const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
const nsIPrefBranchInternal = Components.interfaces.nsIPrefBranchInternal;
this.prefService =
Components.classes[PREF_CTRID].getService(nsIPrefService);
this.prefBranch = this.prefService.getBranch(branchName);
this.prefSaveTime = 0;
this.prefSaveTimer = 0;
this.branchName = branchName;
this.defaultValues = new Object();
this.prefs = new Object();
this.prefNames = new Array();
this.prefRecords = new Object();
this.observer = { observe: pm_observe, branch: branchName };
this.observers = new Array();
this.prefBranchInternal =
this.prefBranch.QueryInterface(nsIPrefBranchInternal);
this.prefBranchInternal.addObserver("", this.observer, false);
this.defaultBundle = defaultBundle;
this.valid = true;
}