Name
WorkerGlobalScope
Inherits from
EventTarget, Global
Synopsis
A Worker thread runs in a completely different execution environment than the parent thread that spawned it. The global object for a worker is a WorkerGlobalScope object, so this page describes the execution environment “inside” a Worker. Since WorkerGlobalScope is a global object, it inherits the Global object of core JavaScript.
Properties
In addition to the properties listed here, WorkerGlobalScope also defines all of the core JavaScript global properties, such as Math and JSON.
readonly WorkerLocationlocationThis property is like the
window.locationLocation object: it allows a worker to inspect the URL it was loaded from and includes properties that return individual portions of the URL.readonly WorkerNavigatornavigatorThis property is like the
window.navigatorNavigator object: it defines properties that allow a worker to determine what browser it is running in and whether it is currently online or not.readonly WorkerGlobalScopeselfThis self-referential property refers to the WorkerGlobalScope global object itself. It is like the
windowproperty of the Window object in the main thread.
Methods
In addition to the properties listed here, WorkerGlobalScope also defines all of the core JavaScript global functions, such as isNaN() and eval().
void clearInterval(long
handle)
clearInterval(long
handle)This method is just like the Window method of the same name.
void clearTimeout(long
handle)
clearTimeout(long
handle)This method is just like the Window method of the same name. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access