nsIObserverService

nsIObserverService


Service allows a client listener (nsIObserver ) to register and unregister for notifications ofa specific string referenced topic. Service also provides a way to notify registered listeners and a way to enumerate registered client listeners

Methods
addObserver

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

Syntax:

void nsIObserverService::addObserver(
	in nsIObserver anObserver,in string aTopic,
	in boolean ownsWeak)  

Parameters:

anObserver: The interface pointer to the object 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.

nsresult:

NS_OK if successful.
removeObserver

Unregisters a given listener from notifications regarding the specified topic.

Syntax:

void nsIObserverService::removeObserver(
	in nsIObserver anObserver,in string aTopic) 

Parameters:

anObserver: The interface pointer to the object which should stop receiving notifications.
aTopic: The notification topic or subject.

nsresult:

NS_OK if successful.
notifyObservers

Notifies all registered listeners of the given topic.

Syntax:

void nsIObserverService::notifyObservers(
	in nsISupports aSubject,in string aTopic,
	in wstring someData)  

Parameters:

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

nsresult:

NS_OK if successful.
enumerateObservers

Returns an enumeration of all registered listeners.

See also: nsISimpleEnumerator .

Syntax:

nsISimpleEnumerator nsIObserverService::enumerateObservers(
	in string aTopic) 

Parameters:

aTopic: The notification topic or subject.

nsresult:

NS_OK if successful.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值