Class Worker
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptableObject
-
- org.htmlunit.javascript.HtmlUnitScriptable
-
- org.htmlunit.javascript.host.event.EventTarget
-
- org.htmlunit.javascript.host.worker.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 forWorker
.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private DedicatedWorkerGlobalScope
workerScope_
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
getOnmessage()
Gets the value of the onmessage event handler.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)
For instantiation in JavaScript.void
postMessage(java.lang.Object message)
Post the provided message to the WebWorker execution.void
setOnmessage(java.lang.Object onmessage)
Sets the value of the onmessage event handler.void
terminate()
Immediately terminates the Worker.-
Methods inherited from class org.htmlunit.javascript.host.event.EventTarget
addEventListener, clearEventListenersContainer, dispatchEvent, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, jsConstructor, removeEventListener, setEventHandler
-
Methods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromise
-
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
-
-
-
-
Field Detail
-
workerScope_
private final DedicatedWorkerGlobalScope workerScope_
-
-
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 contextscope
- the scopeargs
- the URIsctorObj
- the function objectinNewExpr
- 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
-
-