SharedWorkerGlobalScope
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
TheSharedWorkerGlobalScope object (theSharedWorker global scope) is accessible through theself keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in theJavaScript Reference. See the complete list offunctions available to workers.
In this article
Instance properties
This interface inherits properties from theWorkerGlobalScope interface, and its parentEventTarget.
SharedWorkerGlobalScope.nameRead onlyThe name that the
SharedWorkerwas (optionally) given when it was created using theSharedWorker()constructor. This is mainly useful for debugging purposes.
Instance methods
This interface inherits methods from theWorkerGlobalScope interface, and its parentEventTarget.
SharedWorkerGlobalScope.close()Discards any tasks queued in the
SharedWorkerGlobalScope's event loop, effectively closing this particular scope.
Events
Listen to this event usingaddEventListener() or by assigning an event listener to theoneventname property of this interface.
connectFired on shared workers when a new client connects.
Specifications
| Specification |
|---|
| HTML> # shared-workers-and-the-sharedworkerglobalscope-interface> |