1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
9 interface nsISimpleEnumerator
;
14 * Service allows a client listener (nsIObserver) to register and unregister for
15 * notifications of specific string referenced topic. Service also provides a
16 * way to notify registered listeners and a way to enumerate registered client
20 [scriptable
, uuid(D07F5192
-E3D1
-11d2
-8ACD
-00105A1B8860
)]
21 interface nsIObserverService
: nsISupports
27 * Registers a given listener for a notifications regarding the specified
30 * @param anObserve : The interface pointer which will receive notifications.
31 * @param aTopic : The notification topic or subject.
32 * @param ownsWeak : If set to false, the nsIObserverService will hold a
33 * strong reference to |anObserver|. If set to true and
34 * |anObserver| supports the nsIWeakReference interface,
35 * a weak reference will be held. Otherwise an error will be
38 void addObserver
( in nsIObserver anObserver
, in string aTopic
, in boolean ownsWeak
);
43 * Unregisters a given listener from notifications regarding the specified
46 * @param anObserver : The interface pointer which will stop recieving
48 * @param aTopic : The notification topic or subject.
50 void removeObserver
( in nsIObserver anObserver
, in string aTopic
);
55 * Notifies all registered listeners of the given topic.
57 * @param aSubject : Notification specific interface pointer.
58 * @param aTopic : The notification topic or subject.
59 * @param someData : Notification specific wide string.
61 void notifyObservers
( in nsISupports aSubject
,
63 in wstring someData
);
68 * Returns an enumeration of all registered listeners.
70 * @param aTopic : The notification topic or subject.
72 nsISimpleEnumerator enumerateObservers
( in string aTopic
);