WorkerGlobalScope class

The 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 has its own event loop. 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.

EventTarget

WorkerGlobalScope

Implemented types
Implementers
Available extensions
Annotations
  • @JS.new()
  • @staticInterop

Constructors

WorkerGlobalScope()
factory

Properties

caches → CacheStorage

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

no setter
crossOriginIsolated → bool

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

no setter
crypto → Crypto

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

no setter
fonts → FontFaceSet

Available on FontFaceSource, provided by the PropsFontFaceSource extension

no setter
hashCode → int
The hash code for this object.
no setterinherited
indexedDB → IDBFactory

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

no setter
isSecureContext → bool

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

no setter
location → WorkerLocation

Available on WorkerGlobalScope, provided by the PropsWorkerGlobalScope extension

no setter

Available on WorkerGlobalScope, provided by the PropsWorkerGlobalScope extension

no setter
onerror ↔ OnErrorEventHandlerNonNull?

Available on WorkerGlobalScope, provided by the PropsWorkerGlobalScope extension

getter/setter pair
onlanguagechange ↔ EventHandlerNonNull<Event>?

Available on WorkerGlobalScope, provided by the PropsWorkerGlobalScope extension

getter/setter pair
onoffline ↔ EventHandlerNonNull<Event>?

Available on WorkerGlobalScope, provided by the PropsWorkerGlobalScope extension

getter/setter pair
ononline ↔ EventHandlerNonNull<Event>?

Available on WorkerGlobalScope, provided by the PropsWorkerGlobalScope extension

getter/setter pair
onrejectionhandled ↔ EventHandlerNonNull<Event>?

Available on WorkerGlobalScope, provided by the PropsWorkerGlobalScope extension

getter/setter pair
onunhandledrejection ↔ EventHandlerNonNull<Event>?

Available on WorkerGlobalScope, provided by the PropsWorkerGlobalScope extension

getter/setter pair
origin → String

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

no setter
performance → Performance

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scheduler → Scheduler

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

no setter
self → WorkerGlobalScope

Available on WorkerGlobalScope, provided by the PropsWorkerGlobalScope extension

no setter
trustedTypes → TrustedTypePolicyFactory

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

no setter

Methods

addEventListener(String type, EventListener? callback, [dynamic options]) → void

Available on EventTarget, provided by the PropsEventTarget extension

atob(String data) → String

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

btoa(String data) → String

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

clearInterval([int? id = 0]) → void

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

clearTimeout([int? id = 0]) → void

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

createImageBitmap(dynamic image, [int? sx, int? sy, int? sw, int? sh, ImageBitmapOptions? options]) → Future<ImageBitmap>

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

dispatchEvent(Event event) → bool

Available on EventTarget, provided by the PropsEventTarget extension

fetch(dynamic input, [RequestInit? init]) → Future<Response>

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

importScripts([String? urls1, String? urls2, String? urls3]) → void

Available on WorkerGlobalScope, provided by the PropsWorkerGlobalScope extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
queueMicrotask(VoidFunction callback) → void

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

removeEventListener(String type, EventListener? callback, [dynamic options]) → void

Available on EventTarget, provided by the PropsEventTarget extension

reportError(dynamic e) → void

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

setInterval(dynamic handler, [int? timeout = 0, dynamic arguments1, dynamic arguments2, dynamic arguments3]) → int

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

setTimeout(dynamic handler, [int? timeout = 0, dynamic arguments1, dynamic arguments2, dynamic arguments3]) → int

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

structuredClone(dynamic value, [StructuredSerializeOptions? options]) → dynamic

Available on WindowOrWorkerGlobalScope, provided by the PropsWindowOrWorkerGlobalScope extension

toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited