Table of Contents

Class DedicatedWorkerGlobalScope

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

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.

[Value("DedicatedWorkerGlobalScope")]
public class DedicatedWorkerGlobalScope : WorkerGlobalScope, FontFaceSource, WindowOrWorkerGlobalScope, AnimationFrameProvider, MessageEventTarget
Inheritance
DedicatedWorkerGlobalScope
Implements
Inherited Members

Remarks

Constructors

DedicatedWorkerGlobalScope()

public DedicatedWorkerGlobalScope()

Properties

Name

The name read-only property of the
DedicatedWorkerGlobalScope interface returns the name that the
Worker was (optionally) given when it was created. This is the name that
the Worker(Union96, WorkerOptions) constructor can pass to get a reference to
the DedicatedWorkerGlobalScope.

[Value("name")]
public string Name { get; }

Property Value

string

A string.

Remarks

Onrtctransform

[Value("onrtctransform")]
public EventHandlerNonNull Onrtctransform { get; set; }

Property Value

EventHandlerNonNull

Methods

Close()

The close() method of the DedicatedWorkerGlobalScope interface discards any tasks queued in the DedicatedWorkerGlobalScope's event loop, effectively closing this particular scope.

[Value("close")]
public GlobalObject.Undefined Close()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

PostMessage(dynamic, StructuredSerializeOptions)

The postMessage() method of the DedicatedWorkerGlobalScope interface sends a message to the main thread that spawned it.

[Value("postMessage")]
public GlobalObject.Undefined PostMessage(dynamic message, StructuredSerializeOptions options = null)

Parameters

message dynamic
options StructuredSerializeOptions

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

This accepts a data parameter, which contains data to copy from the worker to the main thread.
The data may be any value or JavaScript object handled by the structured clone algorithm, which includes cyclical references.

The method also accepts an optional array of transferable objects to transfer to the main thread;
Unlike the data parameter transferred objects are no longer usable in the worker thread.
(Where possible, objects are transferred using a high performance zero-copy operation).

The main scope that spawned the worker can send back information to the thread that spawned it using the PostMessage(dynamic, List<Object>) method.

The DedicatedWorkerGlobalScope interface it belongs to.

See also on MDN

PostMessage(dynamic, List<Object>)

The postMessage() method of the DedicatedWorkerGlobalScope interface sends a message to the main thread that spawned it.

[Value("postMessage")]
public GlobalObject.Undefined PostMessage(dynamic message, List<Object> transfer)

Parameters

message dynamic
transfer List<Object>

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

This accepts a data parameter, which contains data to copy from the worker to the main thread.
The data may be any value or JavaScript object handled by the structured clone algorithm, which includes cyclical references.

The method also accepts an optional array of transferable objects to transfer to the main thread;
Unlike the data parameter transferred objects are no longer usable in the worker thread.
(Where possible, objects are transferred using a high performance zero-copy operation).

The main scope that spawned the worker can send back information to the thread that spawned it using the PostMessage(dynamic, List<Object>) method.

The DedicatedWorkerGlobalScope interface it belongs to.

See also on MDN