DedicatedWorkerGlobalScope
The DedicatedWorkerGlobalScope
object (the Worker
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 also: Functions available to workers .
EventTarget WorkerGlobalScope DedicatedWorkerGlobalScope
Instance properties
This interface inherits properties from the WorkerGlobalScope
interface, and its parent EventTarget
.
DedicatedWorkerGlobalScope.name
Read only
The name that the Worker
was (optionally) given when it was created using the Worker()
constructor. This is mainly useful for debugging purposes.
Instance methods
This interface inherits methods from the WorkerGlobalScope
interface, and its parent EventTarget
.
DedicatedWorkerGlobalScope.close()
Discards any tasks queued in the WorkerGlobalScope
's event loop, effectively closing this particular scope.
DedicatedWorkerGlobalScope.postMessage()
Sends a message — which can consist of any
JavaScript object — to the parent document that first spawned the worker.
DedicatedWorkerGlobalScope.cancelAnimationFrame()
Cancels an animation frame request previously scheduled through a call to requestAnimationFrame()
.
DedicatedWorkerGlobalScope.requestAnimationFrame()
Perform an animation frame request and call a user-supplied callback function before the next repaint.
Events
Listen to this event using addEventListener()
or by assigning an event listener to the oneventname
property of this interface.
message
Fired when the worker receives a message from its parent.
messageerror
Fired when a worker receives a message that can't be deserialized.
rtctransform
Fired when an encoded video or audio frame has been queued for processing by a WebRTC Encoded Transform .
Specifications
Browser compatibility
Desktop
Mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on IOS
Samsung Internet
WebView Android
DedicatedWorkerGlobalScope
4
12
3.5
10.6
4
18
4
11
5
1.0
4.4
cancelAnimationFrame
69
79
99
56
16.4
69
99
48
16.4
10.0
67
close
4
12
3.5
10.6
4
18
4
11
5
1.0
4.4
message_event
4
12
3.5
10.6
4
18
4
11.5
5
1.0
≤37
messageerror_event
60
18
57
47
16.4
60
57
47
16.4
8.0
60
name
70
18
55
57
12.1
70
55
49
12.2
10.0
70
postMessage
4
12
3.5
10.6
4
18
4
11
5
1.0
4.4
requestAnimationFrame
69
79
99
56
16.4
69
99
48
16.4
10.0
67
rtctransform_event
No
No
117
No
15.4
No
117
No
15.4
No
No
See also