WorkerGlobalScope
The WorkerGlobalScope interface of the Web Workers API is an interface representing the scope of any worker. Workers have no browsing context; this scope contains the information usually conveyed by Window objects — in this case event handlers, the console or the associated WorkerNavigator object. Each WorkerGlobalScope has its own event loop.
Documentation WorkerGlobalScope by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See:
Instance Members
Returns a reference to the WorkerGlobalScope itself. Most of the time it is a specific scope like DedicatedWorkerGlobalScope, SharedWorkerGlobalScope or ServiceWorkerGlobalScope.
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.
Is an EventHandler representing the code to be called when the offline event is raised.
Is an EventHandler representing the code to be called when the online event is raised.
Returns the Performance associated with the worker. It is a regular performance object, except that only a subset of its property and methods are available to workers.
Is an EventHandler representing the code to be called when the error event is raised.
Imports one or more scripts into the worker's scope. You can specify as many as you'd like, separated by commas. For example: importScripts('foo.js', 'bar.js');
Allows you to write a message to stdout — i.e. in your terminal. This is the same as Firefox's window.dump, but for workers.
| Name |
Type |
Default |
str |
String |
(optional) |
structuredClone(value: structuredClone.T, ?options: AnonStruct): structuredClone.T
Creates a deep clone of a given value using the structured clone algorithm.
| Name |
Type |
Default |
value |
structuredClone.T |
|
options |
AnonStruct |
(optional) |
| Returns |
| structuredClone.T |
clearTimeout(?handle: Int = 0): Void
| Name |
Type |
Default |
handle |
Int |
0 |
clearInterval(?handle: Int = 0): Void
| Name |
Type |
Default |
handle |
Int |
0 |