nsIMessageSender 编辑
IDL file: mozilla-central/source/dom/base/nsIMessageManager.idl
Inherits from: nsIMessageListenerManager
Message senders enable clients to send asynchronous messages to a single "other side". For example, a child-process message manager will send messages that are only delivered to its one parent-process message manager.
To send messages to multiple "other sides", you would use nsIMessageBroadcaster
.
See Message Manager interfaces for more details on the distinction between message senders and message broadcasters.
Methods
void sendAsyncMessage([optional] in AString messageName, |
sendAsyncMessage()
Send messageName
and obj
to the "other side" of this message manager. This invokes listeners who registered for messageName
using a nsIMessageListenerManager
.
See nsIMessageListener::receiveMessage()
for the format of the data delivered to listeners.
Throws NS_ERROR_NOT_INITIALIZED
if the sender is not initialized. For example, we will throw NS_ERROR_NOT_INITIALIZED
if we try to send a message to a cross-process frame but the other process has not yet been set up.
Throws NS_ERROR_FAILURE
when the message receiver cannot be found. For example, we will throw NS_ERROR_FAILURE
if we try to send a message to a cross-process frame whose process has crashed.
Parameters
Name | Type | Description |
---|---|---|
messageName | String | The name of the message. Optional. This becomes the |
obj | Object. | The message payload. A structured clone of this becomes the |
objects | Object. | An object each of whose properties is an object. This becomes the |
principal | nsIPrincipal |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论