SharedWorkerGlobalScope

The SharedWorkerGlobalScope object (the SharedWorker 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 the complete list of functions available to workers.

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. It is a specific location object, mostly a subset of the Location for browsing scopes, but adapted to workers.

Link copied to clipboard

The name read-only property of the SharedWorkerGlobalScope interface returns the name that the SharedWorker was (optionally) given when it was created. This is the name that the SharedWorker() constructor can pass to get a reference to the SharedWorkerGlobalScope.

Link copied to clipboard

The navigator read-only property of the WorkerGlobalScope interface returns the WorkerNavigator associated with the worker. It is a specific navigator object, mostly a subset of the Navigator for browsing scopes, but adapted to workers.

Functions

Link copied to clipboard
open override fun close()

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

Link copied to clipboard
open fun dispatchEvent(event: Event): Boolean
Link copied to clipboard
open operator fun get(key: String): JsAny?
open operator fun get(key: PropertyKey): JsAny?
Link copied to clipboard
open operator fun set(key: String, value: JsAny?)
open operator fun set(key: PropertyKey, value: JsAny?)
Link copied to clipboard