Class Worker

java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
All Implemented Interfaces:
Serializable, 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:
  • 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
     

    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
     
    Default constructor.
    private
    Worker(org.htmlunit.corejs.javascript.Context cx, Window owningWindow, String url)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the value of the onmessage event handler.
    static Worker
    jsConstructor(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, Object[] args, org.htmlunit.corejs.javascript.Function ctorObj, boolean inNewExpr)
    For instantiation in JavaScript.
    void
    Post the provided message to the WebWorker execution.
    void
    setOnmessage(Object onmessage)
    Sets the value of the onmessage event handler.
    void
    Immediately terminates the Worker.

    Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Worker

      public Worker()
      Default constructor.
    • Worker

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

    • jsConstructor

      public static Worker jsConstructor(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, Object[] args, org.htmlunit.corejs.javascript.Function ctorObj, boolean inNewExpr) throws 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:
      Exception - in case of problem
    • postMessage

      public void postMessage(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(Object onmessage)
      Sets the value of the onmessage event handler.
      Parameters:
      onmessage - the new handler
    • getOnmessage

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