FUEL:PreferenceBranch
From MDC
This article covers features introduced in Firefox 3
Contents |
[edit] Method overview
boolean has(in AString aName)
|
fuelIPreference get(in AString aName)
|
nsIVariant getValue(in AString aName, in nsIVariant aDefaultValue)
|
void setValue(in AString aName, in nsIVariant aValue)
|
void reset()
|
[edit] Attributes
| Attribute | Type | Description |
root
| readonly attribute AString
| The name of the branch root. |
all
| readonly attribute nsIVariant
| Array of fuelIPreference listing all preferences in this branch. |
events
| readonly attribute fuelIEvents
| The events object for the preferences supports: "change" |
[edit] Methods
[edit] has()
Check to see if a preference exists.
boolean has(in AString aName)
[edit] Parameters
- aName
- The name of preference
[edit] Return value
true if the preference exists, false if not
[edit] get()
Gets an object representing a preference
fuelIPreference get(in AString aName)
[edit] Parameters
- aName
- The name of preference
[edit] Return value
a preference object, or null if the preference does not exist
[edit] getValue()
Gets the value of a preference. Returns a default value if the preference does not exist.
nsIVariant getValue(in AString aName, in nsIVariant aDefaultValue)
[edit] Parameters
- aName
- The name of a preference
- aDefaultValue
- The default value of a preference
[edit] Return value
value of the preference or the given default value if preference does not exists.
[edit] setValue()
Sets the value of a preference with the given name.
void setValue(in AString aName, in nsIVariant aValue)
[edit] Parameters
- aName
- The name of a preference
- aValue
- The value of a preference
[edit] Return value
[edit] reset()
Resets all preferences in a branch back to their default values.
void reset()
[edit] Parameters
[edit] Return value
[edit] Examples
var myExt = Application.extensions.get('myapplicationid').;
function myFunc (event) {
Application.console.log('change!');
};
myExt.prefs.get("myprefname").events.addListener("change", myFunc);