DedicatedWorkerGlobalScope Class
The global object of a dedicated worker (https://html.spec.whatwg.org/multipage/workers.html#dedicated-workers-and-the-dedicatedworkerglobalscope-interface): the messages it posts are fired at its Worker object, and the errors it does not handle are propagated to it.
public sealed class DedicatedWorkerGlobalScope : WorkerGlobalScope- Inheritance
WorkerGlobalScopeDedicatedWorkerGlobalScope
Properties
| Name | Description |
|---|---|
| OnMessage | Gets or sets the event handler of the message event. |
| OnMessageError | Gets or sets the event handler of the messageerror event. |
| WorkerName | https://html.spec.whatwg.org/multipage/workers.html#dom-dedicatedworkerglobalscope-name |
OnMessage
WorkerGlobalScope.csGets or sets the event handler of the message event.
OnMessageError
WorkerGlobalScope.csGets or sets the event handler of the messageerror event.
WorkerName
WorkerGlobalScope.cshttps://html.spec.whatwg.org/multipage/workers.html#dom-dedicatedworkerglobalscope-name
public string WorkerName { get; }Methods
| Name | Description |
|---|---|
| CancelAnimationFrame(uint) | https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animationframeprovider-cancelanimationframe |
| Close() | Closes the worker: its event loop ends once the running task completes (https://html.spec.whatwg.org/multipage/workers.html#dom-dedicatedworkerglobalscope-close). |
| PostMessage(object?, StructuredSerializeOptions?) | Posts a message to the Worker object (https://html.spec.whatwg.org/multipage/workers.html#dom-dedicatedworkerglobalscope-postmessage-options). |
| PostMessage(object?, IReadOnlyList<object>) | Posts a message to the Worker object (https://html.spec.whatwg.org/multipage/workers.html#dom-dedicatedworkerglobalscope-postmessage). |
| RequestAnimationFrame(FrameRequestCallback) | https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-animationframeprovider-requestanimationframe: runs the callback at the next frame of the worker. There is no rendering: the frames run at a fixed rate (60 frames per second) measured with DomEventLoop.TimeProvider. |
CancelAnimationFrame(uint)
WorkerGlobalScope.cshttps://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animationframeprovider-cancelanimationframe
Close()
WorkerGlobalScope.csCloses the worker: its event loop ends once the running task completes (https://html.spec.whatwg.org/multipage/workers.html#dom-dedicatedworkerglobalscope-close).
public void Close()PostMessage overloads
PostMessage(object?, StructuredSerializeOptions?)
WorkerGlobalScope.csPosts a message to the Worker object (https://html.spec.whatwg.org/multipage/workers.html#dom-dedicatedworkerglobalscope-postmessage-options).
public void PostMessage(object? message, StructuredSerializeOptions? options = null)PostMessage(object?, IReadOnlyList<object>)
WorkerGlobalScope.csPosts a message to the Worker object (https://html.spec.whatwg.org/multipage/workers.html#dom-dedicatedworkerglobalscope-postmessage).
public void PostMessage(object? message, IReadOnlyList<object> transfer)RequestAnimationFrame(FrameRequestCallback)
WorkerGlobalScope.cshttps://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-animationframeprovider-requestanimationframe: runs the callback at the next frame of the worker. There is no rendering: the frames run at a fixed rate (60 frames per second) measured with DomEventLoop.TimeProvider.
public uint RequestAnimationFrame(FrameRequestCallback callback)Parameters
callbackFrameRequestCallback
Returns
Exceptions
DomException- A
NotSupportedErrorwhen the owner of the worker is not a window (a nested worker).