Table of Contents

Class WorkerGlobalScope

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

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.

[Value("WorkerGlobalScope")]
public class WorkerGlobalScope : EventTarget, FontFaceSource, WindowOrWorkerGlobalScope
Inheritance
WorkerGlobalScope
Implements
Derived
Inherited Members

Remarks

This interface is usually specialized by each worker type: DedicatedWorkerGlobalScope for dedicated workers, SharedWorkerGlobalScope for shared workers, and ServiceWorkerGlobalScope for ServiceWorker. The self property returns the specialized scope for each context.

-Other global object interface: Window, DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, ServiceWorkerGlobalScope
-Other Worker-related interfaces: Worker, WorkerLocation and WorkerNavigator
-Using web workers

See also on MDN

Constructors

WorkerGlobalScope()

public WorkerGlobalScope()

Properties

Location

The location read-only property of the WorkerGlobalScope interface 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.

[Value("location")]
public WorkerLocation Location { get; }

Property Value

WorkerLocation

A WorkerLocation object.

Remarks

Navigator

The navigator read-only property of the WorkerGlobalScope interface returns the WorkerNavigator associated with the worker. It is a specific navigator object, mostly a subset of the Navigator for browsing scopes, but adapted to workers.

[Value("navigator")]
public WorkerNavigator Navigator { get; }

Property Value

WorkerNavigator

A WorkerNavigator object.

Remarks

Onerror

[Value("onerror")]
public OnErrorEventHandlerNonNull Onerror { get; set; }

Property Value

OnErrorEventHandlerNonNull

Onlanguagechange

[Value("onlanguagechange")]
public EventHandlerNonNull Onlanguagechange { get; set; }

Property Value

EventHandlerNonNull

Onoffline

[Value("onoffline")]
public EventHandlerNonNull Onoffline { get; set; }

Property Value

EventHandlerNonNull

Ononline

[Value("ononline")]
public EventHandlerNonNull Ononline { get; set; }

Property Value

EventHandlerNonNull

Onrejectionhandled

[Value("onrejectionhandled")]
public EventHandlerNonNull Onrejectionhandled { get; set; }

Property Value

EventHandlerNonNull

Onunhandledrejection

[Value("onunhandledrejection")]
public EventHandlerNonNull Onunhandledrejection { get; set; }

Property Value

EventHandlerNonNull

Self

The self read-only property of the WorkerGlobalScope interface returns a reference to the WorkerGlobalScope itself. Most of the time it is a specific scope like DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, or ServiceWorkerGlobalScope.

[Value("self")]
public WorkerGlobalScope Self { get; }

Property Value

WorkerGlobalScope

A global scope object (differs depending on the type of worker you are dealing with, as indicated above).

Remarks

Methods

ImportScripts(params Union95[])

The importScripts() method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope.

[Value("importScripts")]
public GlobalObject.Undefined ImportScripts(params Union95[] urls)

Parameters

urls Union95[]

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks