DedicatedWorkerGlobalScope

The DedicatedWorkerGlobalScope object (the Worker global scope) is accessible through the WorkerGlobalScope.self keyword.

MDN Reference

Properties

Link copied to clipboard
Link copied to clipboard

The location read-only property of the WorkerGlobalScope interface returns the WorkerLocation associated with the worker.

Link copied to clipboard

The name read-only property of the the Worker.Worker constructor can pass to get a reference to the DedicatedWorkerGlobalScope.

Link copied to clipboard

The navigator read-only property of the WorkerGlobalScope interface returns the WorkerNavigator associated with the worker.

Functions

Link copied to clipboard
fun close()

The close() method of the DedicatedWorkerGlobalScope interface discards any tasks queued in the DedicatedWorkerGlobalScope's event loop, effectively closing this particular scope.

Link copied to clipboard
Link copied to clipboard
open operator fun get(key: JsString): JsAny?
Link copied to clipboard
fun postMessage(message: JsAny?, transfer: ReadonlyArray<Transferable>)

The postMessage() method of the DedicatedWorkerGlobalScope interface sends a message to the main thread that spawned it.

fun postMessage(message: JsAny?, options: StructuredSerializeOptions = definedExternally)
Link copied to clipboard
open operator fun set(key: JsString, value: JsAny?)
Link copied to clipboard