WorkerGlobalScope
Generated from idl/workers.webidl when the site was built at 7aa23e2.
WorkerGlobalScope is an interface in idl/workers.webidl, inheriting EventTarget, exposed in Worker. It includes WindowOrWorkerGlobalScope. What it does is on MDN; this page says what niso has of it.
Status
Section titled “Status”The web features its members belong to, each with its Baseline status on the web and how much of the feature’s WPT suite passes in niso (see Web platform support).
| Feature | On the web | In niso | Members |
|---|---|---|---|
| Dedicated workers | Widely available | Partial 85% 410 of 477 subtests pass | 6 |
| Online status | Widely available | Not yet 0 of 3 subtests pass | 2 |
| Language | Widely available | Full 2 of 2 subtests pass | 1 |
Members
Section titled “Members”readonly attribute WorkerGlobalScope self;int32_t niso_worker_global_scope_get_self(niso_dom* dom, niso_handle self, niso_handle* out);location
Section titled “location”readonly attribute WorkerLocation location;int32_t niso_worker_global_scope_get_location(niso_dom* dom, niso_handle self, niso_handle* out);onerror
Section titled “onerror”attribute EventHandler onerror;int32_t niso_worker_global_scope_get_onerror(niso_dom* dom, niso_handle self, void** out);int32_t niso_worker_global_scope_set_onerror(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);OnErrorEventHandler: the binding calls the handler with the ErrorEvent’s message, filename, lineno, colno and error.
onlanguagechange
Section titled “onlanguagechange”attribute EventHandler onlanguagechange;int32_t niso_worker_global_scope_get_onlanguagechange(niso_dom* dom, niso_handle self, void** out);int32_t niso_worker_global_scope_set_onlanguagechange(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);onoffline
Section titled “onoffline”attribute EventHandler onoffline;int32_t niso_worker_global_scope_get_onoffline(niso_dom* dom, niso_handle self, void** out);int32_t niso_worker_global_scope_set_onoffline(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);ononline
Section titled “ononline”attribute EventHandler ononline;int32_t niso_worker_global_scope_get_ononline(niso_dom* dom, niso_handle self, void** out);int32_t niso_worker_global_scope_set_ononline(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);onrejectionhandled
Section titled “onrejectionhandled”attribute EventHandler onrejectionhandled;int32_t niso_worker_global_scope_get_onrejectionhandled(niso_dom* dom, niso_handle self, void** out);int32_t niso_worker_global_scope_set_onrejectionhandled(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);onunhandledrejection
Section titled “onunhandledrejection”attribute EventHandler onunhandledrejection;int32_t niso_worker_global_scope_get_onunhandledrejection(niso_dom* dom, niso_handle self, void** out);int32_t niso_worker_global_scope_set_onunhandledrejection(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);report()
Section titled “report()”[NisoInternal, NisoReentrant] undefined report(DOMString message, USVString filename, unsigned long lineno, unsigned long colno, [NisoHeld] any error);int32_t niso_worker_global_scope_report(niso_dom* dom, niso_handle self, const char* message, size_t message_len, const char* filename, size_t filename_len, uint32_t lineno, uint32_t colno, niso_held error);HTML’s “report an exception” for an uncaught exception with these details: fires an ErrorEvent at the global, and when it was not canceled, the error goes on to the Worker object in the parent.
createImageBitmap()
Section titled “createImageBitmap()”[NisoGlue] Promise<ImageBitmap> createImageBitmap(any image, optional any a, optional any b, optional any c, optional any d, optional any e);bitmapFrom()
Section titled “bitmapFrom()”[NisoInternal] ImageBitmap bitmapFrom(Element? element, ImageBitmap? bitmap, OffscreenCanvas? offscreen, Uint8ClampedArray data, unsigned long width, unsigned long height, boolean crop, long sx, long sy, long sw, long sh);int32_t niso_window_or_worker_global_scope_bitmap_from(niso_dom* dom, niso_handle self, niso_handle element, niso_handle bitmap, niso_handle offscreen, const uint8_t* data, size_t data_len, uint32_t width, uint32_t height, bool crop, int32_t sx, int32_t sy, int32_t sw, int32_t sh, niso_handle* out);One of element, bitmap and offscreen is the image, or data (width by height straight RGBA) when all three are null; cropped to sx, sy, sw, sh when crop is set.
bitmapDecode()
Section titled “bitmapDecode()”[NisoInternal] ImageBitmap? bitmapDecode(ArrayBuffer bytes);int32_t niso_window_or_worker_global_scope_bitmap_decode(niso_dom* dom, niso_handle self, const uint8_t* bytes, size_t bytes_len, niso_handle* out);An image file’s bytes decoded.
origin
Section titled “origin”readonly attribute USVString origin;int32_t niso_window_or_worker_global_scope_get_origin(niso_dom* dom, niso_handle self, niso_str* out);The standard’s is [Replaceable], which the generator does not support.
setTimeout()
Section titled “setTimeout()”long setTimeout(TimerHandler handler, optional long timeout = 0);int32_t niso_window_or_worker_global_scope_set_timeout(niso_dom* dom, niso_handle self, niso_timer_handler_fn handler_fn, void* handler_userdata, niso_drop_fn handler_drop, int32_t timeout, int32_t* out);clearTimeout()
Section titled “clearTimeout()”undefined clearTimeout(optional long id = 0);int32_t niso_window_or_worker_global_scope_clear_timeout(niso_dom* dom, niso_handle self, int32_t id);setInterval()
Section titled “setInterval()”long setInterval(TimerHandler handler, optional long timeout = 0);int32_t niso_window_or_worker_global_scope_set_interval(niso_dom* dom, niso_handle self, niso_timer_handler_fn handler_fn, void* handler_userdata, niso_drop_fn handler_drop, int32_t timeout, int32_t* out);clearInterval()
Section titled “clearInterval()”undefined clearInterval(optional long id = 0);int32_t niso_window_or_worker_global_scope_clear_interval(niso_dom* dom, niso_handle self, int32_t id);queueTask()
Section titled “queueTask()”[NisoInternal] undefined queueTask(VoidFunction callback);int32_t niso_window_or_worker_global_scope_queue_task(niso_dom* dom, niso_handle self, niso_void_function_fn callback_fn, void* callback_userdata, niso_drop_fn callback_drop);Queues a task on the DOM’s task queue that calls callback: HTML’s “queue a global task”, for the binding’s own algorithms (postMessage, script events), which run in Dom::run like the DOM’s own tasks.
indexedDB
Section titled “indexedDB”[SameObject] readonly attribute IDBFactory indexedDB;int32_t niso_window_or_worker_global_scope_get_indexed_db(niso_dom* dom, niso_handle self, niso_handle* out);performance
Section titled “performance”readonly attribute Performance performance;int32_t niso_window_or_worker_global_scope_get_performance(niso_dom* dom, niso_handle self, niso_handle* out);crypto
Section titled “crypto”[SameObject] readonly attribute Crypto crypto;int32_t niso_window_or_worker_global_scope_get_crypto(niso_dom* dom, niso_handle self, niso_handle* out);Not in niso yet
Section titled “Not in niso yet”Members the web has, by the BCD keys web-features 3.45.0 lists, that idl/ doesn’t declare. The list is partial: web-features lists only the keys it maps to a feature.
fonts(Font loading)importScripts(Dedicated workers)navigator(Dedicated workers)securitypolicyviolation event(Content Security Policy (CSP))