Skip to content

Worker

Generated from idl/workers.webidl when the site was built at 7aa23e2.

Worker is an interface in idl/workers.webidl, inheriting EventTarget, exposed in Window, DedicatedWorker. What it does is on MDN; this page says what niso has of it.

The standard’s scriptURL is (TrustedScriptURL or USVString), and WorkerOptions’ type and credentials are the WorkerType and RequestCredentials enumerations, which the core checks.

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 4
postMessage Widely available Partial 70% 309 of 441 subtests pass 1
messageerror Widely available Partial 75% 3 of 4 subtests pass 1
constructor
constructor(USVString scriptURL, optional WorkerOptions options = {});
int32_t niso_worker_new(niso_dom* dom, const char* script_url, size_t script_url_len, const niso_worker_options* options, niso_handle* out);
operation
undefined terminate();
int32_t niso_worker_terminate(niso_dom* dom, niso_handle self);
operation not in JS
[NisoInternal] undefined send(ArrayBuffer message, sequence<MessagePort> transfer);
int32_t niso_worker_send(niso_dom* dom, niso_handle self, const uint8_t* message, size_t message_len, const niso_handle* transfer, size_t transfer_len);
attribute postMessage: Partial 70%
attribute EventHandler onmessage;
int32_t niso_worker_get_onmessage(niso_dom* dom, niso_handle self, void** out);
int32_t niso_worker_set_onmessage(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);
attribute messageerror: Partial 75%
attribute EventHandler onmessageerror;
int32_t niso_worker_get_onmessageerror(niso_dom* dom, niso_handle self, void** out);
int32_t niso_worker_set_onmessageerror(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);
attribute
attribute EventHandler onerror;
int32_t niso_worker_get_onerror(niso_dom* dom, niso_handle self, void** out);
int32_t niso_worker_set_onerror(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);

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.

  • postMessage (postMessage)
  • worker_support (Dedicated workers)