Class Worker

  • 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 Worker
    extends EventTarget
    A JavaScript object for Worker.
    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 DedicatedWorkerGlobalScope workerScope_  
      • 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 
      Modifier Constructor Description
        Worker()
      Default constructor.
      private Worker​(org.htmlunit.corejs.javascript.Context cx, Window owningWindow, java.lang.String url)  
    • Constructor Detail

      • Worker

        public Worker()
        Default constructor.
      • Worker

        private Worker​(org.htmlunit.corejs.javascript.Context cx,
                       Window owningWindow,
                       java.lang.String url)
                throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • jsConstructor

        public static Worker jsConstructor​(org.htmlunit.corejs.javascript.Context cx,
                                           org.htmlunit.corejs.javascript.Scriptable scope,
                                           java.lang.Object[] args,
                                           org.htmlunit.corejs.javascript.Function ctorObj,
                                           boolean inNewExpr)
                                    throws java.lang.Exception
        For instantiation in JavaScript.
        Parameters:
        cx - the current context
        scope - the scope
        args - the URIs
        ctorObj - the function object
        inNewExpr - Is new or not
        Returns:
        the java object to allow JavaScript to access
        Throws:
        java.lang.Exception - in case of problem
      • postMessage

        public void postMessage​(java.lang.Object message)
        Post the provided message to the WebWorker execution.
        Parameters:
        message - the message
      • terminate

        public void terminate()
        Immediately terminates the Worker. This does not offer the worker an opportunity to finish its operations; it is stopped at once.
      • setOnmessage

        public void setOnmessage​(java.lang.Object onmessage)
        Sets the value of the onmessage event handler.
        Parameters:
        onmessage - the new handler
      • getOnmessage

        public java.lang.Object getOnmessage()
        Gets the value of the onmessage event handler.
        Returns:
        the handler