Interface nsIObserverServiceType

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.

Hierarchy

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • AddObserver

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

    Parameters

    • anObserver: nsIObserver
    • aTopic: string

      : The notification topic or subject.

    • ownsWeak: boolean

      : 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.

    Returns void

  • enumerateObservers

    Returns an enumeration of all registered listeners.

    Parameters

    • aTopic: string

      : The notification topic or subject.

    Returns nsISimpleEnumerator

  • hasObservers

    Checks to see if there are registered listeners for the given topic.

    Implemented in "nsObserverService.cpp".

    Parameters

    • aTopic: string

      : The notification topic or subject.

    Returns boolean

  • notifyObservers

    Notifies all registered listeners of the given topic. Must not be used with shutdown topics (will assert on the parent process).

    Parameters

    • aSubject: nsISupports

      : Notification specific interface pointer.

    • aTopic: string

      : The notification topic or subject.

    • someData: wstring

      : Notification specific wide string.

    Returns void

  • removeObserver

    Unregisters a given listener from notifications regarding the specified topic.

    Parameters

    • anObserver: nsIObserver

      : The interface pointer which will stop recieving notifications.

    • aTopic: string

      : The notification topic or subject.

    Returns void

Generated using TypeDoc