nsIObserverService

nsIObserverService

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.

Methods

addObserver(anObserver, aTopic, ownsWeak)

AddObserver

Registers a given listener for a notifications regarding the specified
topic.

Parameters

anObserve : The interface pointer which will receive notifications.
aTopic : 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.

removeObserver(anObserver, aTopic)

removeObserver

Unregisters a given listener from notifications regarding the specified
topic.

Parameters

anObserver : The interface pointer which will stop recieving notifications.
aTopic : The notification topic or subject.

notifyObservers(aSubject, aTopic, someData)

notifyObservers

Notifies all registered listeners of the given topic.

Parameters

aSubject : Notification specific interface pointer.
aTopic : The notification topic or subject.
someData : Notification specific wide string.

enumerateObservers(aTopic)

enumerateObservers

Returns an enumeration of all registered listeners.

Parameters

aTopic : The notification topic or subject.