nsIFrameMessageManager 编辑

content/base/public/nsIMessageManager.idlScriptable Provides methods for managing message listeners on local frames. This provides a way for local frames to receive messages from remote frames. 1.0 66 Introduced Gecko 2.0 Obsolete Gecko 17.0 Inherits from: nsISupports Last changed in Gecko 17.0 (Firefox 17.0 / Thunderbird 17.0 / SeaMonkey 2.14)

This interface is obsolete and was removed in Firefox 17. You should use nsIMessageListenerManager or nsIMessageSender instead.

Method overview

void addMessageListener(in AString aMessage, in nsIFrameMessageListener aListener, [optional] in boolean listenWhenClosed);
void removeMessageListener(in AString aMessage, in nsIFrameMessageListener aListener);
void sendAsyncMessage(in AString aMessage, in AString json);

Methods

addMessageListener()

Adds a message listener to the local frame. This listener will receive messages sent from the remote frame.

void addMessageListener(
  in AString aMessage,
  in nsIFrameMessageListener aListener
  [optional in boolean listenWhenClosed
);
Parameters
aMessage
The name of the message for which to add a listener.
aListener
An object implementing nsIFrameMessageListener whose receiveMessage method will be called when the message is received.
listenWhenClosed
Default is false. Set to oo if you want to receive messages during the short period after a frame has been removed from the DOM and before its frame script has finished unloading. This parameter only has an effect for frame message managers in the main process. An alternative method to listen for death of frame script is to use message-manager-disconnect  observer: Observer Notifications :: Message Manager.

removeMessageListener()

Removes a message listener previously added by calling addMessageListener().

void removeMessageListener(
  in AString aMessage,
  in nsIFrameMessageListener aListener
);
Parameters
aMessage
The name of the message for which to remove a listener.
aListener
An object implementing nsIFrameMessageListener to stop receiving messages.

sendAsyncMessage()

Asynchronously sends a message to the listeners.

void sendAsyncMessage(
  in AString aMessage,
  in AString json
);
Parameters
aMessage
The name of the message to send to the listeners.
json Optional
A JSON object containing data to be delivered to the listeners.

See also







 
 
 
 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:98 次

字数:5266

最后编辑:6年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文