DedicatedWorkerGlobalScope

(the Worker global scope) is accessible through the self keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in the JavaScript Reference. See also: Functions available to workers.

MDN Reference

Properties

Link copied to clipboard
Link copied to clipboard

Returns workerGlobal's WorkerLocation object.

Link copied to clipboard

Returns dedicatedWorkerGlobal's name, i.e. the value given to the Worker constructor. Primarily useful for debugging.

Link copied to clipboard

Returns workerGlobal's WorkerNavigator object.

Functions

Link copied to clipboard
fun close()

Aborts dedicatedWorkerGlobal.

Link copied to clipboard
Link copied to clipboard
fun postMessage(message: Any?, transfer: ReadonlyArray<Transferable>)

Clones message and transmits it to the Worker object associated with dedicatedWorkerGlobal. transfer can be passed as a list of objects that are to be transferred rather than cloned.

fun postMessage(message: Any?, options: StructuredSerializeOptions = definedExternally)