nsIObserverService
| IID: | D07F5192-E3D1-11d2-8ACD-00105A1B8860 |
| Inherits From: | nsISupports |
| Status: | FROZEN |
Service allows a client listener (nsIObserver) to register and unregister for notifications of specific string referenced topic. Service also provides a way to notify registered listeners and a way to enumerate registered client listeners.
This interface is intended to be used as a service. To create an object implementing this interface:
var obj = Components.classes["@mozilla.org/observer-service;1"].
getService(Components.interfaces.nsIObserverService);This interface is implemented by the following components:
Methods
void addObserver ( nsIObserver anObserver , char* topic , PRBool ownsWeak )
nsISimpleEnumerator enumerateObservers ( char* topic )
void notifyObservers ( nsISupports subject , char* topic , PRUnichar* someData )
void removeObserver ( nsIObserver anObserver , char* topic )
void addObserver ( nsIObserver anObserver , char* topic , PRBool ownsWeak )
Registers a given listener for a notifications regarding the specified topic.
- Arguments:
- anObserver
- topic: : The notification topic or subject.
- ownsWeak: : If set to false, the nsIObserverService will hold a strong reference to |anObserver|. If set to true and |anObserver| supports the nsIWeakReference interface, a weak reference will be held. Otherwise an error will be returned.
nsISimpleEnumerator enumerateObservers ( char* topic )
Returns an enumeration of all registered listeners.
- Arguments:
- topic: : The notification topic or subject.
void notifyObservers ( nsISupports subject , char* topic , PRUnichar* someData )
Notifies all registered listeners of the given topic.
- Arguments:
- subject: : Notification specific interface pointer.
- topic: : The notification topic or subject.
- someData: : Notification specific wide string.
void removeObserver ( nsIObserver anObserver , char* topic )
Unregisters a given listener from notifications regarding the specified topic.
- Arguments:
- anObserver: : The interface pointer which will stop recieving notifications.
- topic: : The notification topic or subject.
Reference documentation is generated from Mozilla's source.
