Class MessagePort

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

    public class MessagePort
    extends EventTarget
    A JavaScript object for MessagePort.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private MessagePort port1_  
      • Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
      • Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

        NOT_FOUND
    • Constructor Summary

      Constructors 
      Constructor Description
      MessagePort()
      Default constructor.
      MessagePort​(MessagePort port1)
      Constructors port2 with the specified port1.
    • Constructor Detail

      • MessagePort

        public MessagePort()
        Default constructor.
      • MessagePort

        public MessagePort​(MessagePort port1)
        Constructors port2 with the specified port1.
        Parameters:
        port1 - the port1
    • Method Detail

      • getOnmessage

        public java.lang.Object getOnmessage()
        Returns the value of the window's onmessage property.
        Returns:
        the value of the window's onmessage property
      • setOnmessage

        public void setOnmessage​(java.lang.Object onmessage)
        Sets the value of the window's onmessage property.
        Parameters:
        onmessage - the value of the window's onmessage property
      • getHandlerForJavaScript

        private java.lang.Object getHandlerForJavaScript​(java.lang.String eventName)
      • setHandlerForJavaScript

        private void setHandlerForJavaScript​(java.lang.String eventName,
                                             java.lang.Object handler)
      • postMessage

        public void postMessage​(java.lang.String message,
                                java.lang.Object transfer)
        Posts a message.
        Parameters:
        message - the object passed to the window
        transfer - an optional sequence of Transferable objects
        See Also:
        MDN documentation