nsIMessageBroadcaster
, nsIMessageSender
, or nsISyncMessageSender
interfaces.
nsISupports
Last changed in Gecko 41 (Firefox 41 / Thunderbird 41 / SeaMonkey 2.38)Implemented by: @mozilla.org/globalmessagemanager;1
. To access this service, use:
var globalMM = Components.classes["@mozilla.org/globalmessagemanager;1"] .getService(Components.interfaces.nsIMessageListenerManager);
void addMessageListener(in AString messageName, |
void removeMessageListener(in AString messageName, |
void addWeakMessageListener(in AString messageName, |
void removeWeakMessageListener(in AString messageName, |
Register listener
to receive messageName
. All listener callbacks for a particular message are invoked when that message is received. The message manager holds a strong reference to listener
. If the same listener registers twice for the same message, the second registration is ignored.
void addMessageListener(in AString messageName, in nsIMessageListener listener, [optional] in boolean listenWhenClosed);
messageName
listener
nsIMessageListener
to invoke when a message is received. See nsIMessageListener
for details of the message syntax.listenWhenClosed
true
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 is false
by default. 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 a message-manager-disconnect
observer; see Observer Notifications :: Message Manager.Undo an
call; that is, calling this causes addMessageListener()
listener
to stop being invoked when the specified message is received.
void removeMessageListener(in AString messageName, in nsIMessageListener listener);
removeMessageListener()
does not remove a message listener added via
; use addWeakMessageListener()
for that.removeWeakMessageListener
()
messageName
listener
nsIMessageListener
representing the listener to remove.This is just like
, except that the message manager holds a weak reference to addMessageListener()
listener
.
void addWeakMessageListener(in AString messageName, in nsIMessageListener listener);
If you have two weak message listeners for the same message, they may be called in any order.
messageName
listener
nsIMessageListener
to invoke when a message is received. See nsIMessageListener
for details of the message syntax.Undo an
call. That is, calling this causes the addWeakMessageListener()
listener
to no longer be invoked when messageName
is received.
void removeWeakMessageListener(in AString messageName, in nsIMessageListener listener);
removeWeakMessageListener()
does not remove a message listener added via
; use addMessageListener()
for that.removeMessageListener
()
messageName
listener
nsIMessageListener
representing the listener to remove.