class DedicatedWorkerGlobalScope
package js.html
extends WorkerGlobalScope › EventTarget
Available on js
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.
Documentation DedicatedWorkerGlobalScope by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
Variables
read onlyname:String
The name that the Worker
was (optionally) given when it was created using the Worker.Worker
constructor. This is mainly useful for debugging purposes.
onmessage:Function
Is an EventHandler
representing the code to be called when the message
event is raised. These events are of type MessageEvent
and will be called when the worker receives a message from the document that started it (i.e. from the Worker.postMessage
method.)
onmessageerror:Function
Is an EventHandler
representing the code to be called when the messageerror
event is raised.
Methods
close():Void
Discards any tasks queued in the WorkerGlobalScope
's event loop, effectively closing this particular scope.
postMessage(message:Dynamic, ?transfer:Array<Dynamic>):Void
Sends a message — which can consist of any
JavaScript object — to the parent document that first spawned the worker.
Throws:
null | DOMError |
---|