nsIPrefBranch2
| IID: | 74567534-eb94-4b1c-8f45-389643bfc555 |
| Inherits From: | nsIPrefBranch |
| Status: | FROZEN |
nsIPrefBranch2 allows clients to observe changes to pref values.
This interface is implemented by the following components:
Methods
void addObserver ( char* domain , nsIObserver observer , PRBool holdWeak )
void removeObserver ( char* domain , nsIObserver observer )
void addObserver ( char* domain , nsIObserver observer , PRBool holdWeak )
Add a preference change observer. On preference changes, the following arguments will be passed to the nsIObserver.observe() method: subject - The nsIPrefBranch object (this) topic - The string defined by NS_PREFBRANCH_PREFCHANGE_TOPIC_ID data - The name of the preference which has changed, relative to the root of the subject branch.
ASubject.get*Pref(aData) will get the new value of the modified preference. For example, if your observer is registered with addObserver("bar.", ...) on a branch with root "foo.", modifying the preference "foo.bar.baz" will trigger the observer, and data parameter will be "bar.baz".
- Arguments:
- domain: The preference on which to listen for changes. This can be the name of an entire branch to observe. e.g. Holding the "root" prefbranch and calling addObserver("foo.bar.", ...) will observe changes to foo.bar.baz and foo.bar.bzip
- observer: The object to be notified if the preference changes.
- holdWeak: true Hold a weak reference to |observer|. The object must implement the nsISupportsWeakReference interface or this will fail. false Hold a strong reference to |observer|.
void removeObserver ( char* domain , nsIObserver observer )
Remove a preference change observer.
- Arguments:
- domain: The preference which is being observed for changes.
- observer: An observer previously registered with addObserver().
Reference documentation is generated from Mozilla's source.
