Documentation/WorkerGlobalScope
classWORKER

WorkerGlobalScope

js/worker.js:1030

Global object available inside every JSplitter Worker.

propertyWORKERreadonly

name

js/worker.js:1046
name: string = ""

Immutable Worker identity supplied through the Worker constructor. The value is fixed for the Worker's lifetime. JSplitter reports the same name in window.JsMemoryStats and in unhandled Worker exception diagnostics. If no name was supplied this value is an empty string; diagnostics display it as <unnamed>.

propertyWORKER

onerror

js/worker.js:1088
onerror: ?WorkerErrorCallback = null

Global error handler for uncaught Worker task exceptions. The callback receives an ErrorEvent with the error text and Worker source location. When this handler or a Worker-global error listener is installed, the error is handled locally and is not forwarded to the parent Worker.

propertyWORKER

onmessage

js/worker.js:1073
onmessage: ?WorkerMessageCallback = null

Receives messages sent by the parent through Worker.postMessage.

propertyWORKER

onmessageerror

js/worker.js:1080
onmessageerror: ?WorkerMessageCallback = null

Receives a MessageEvent when a serialized parent message cannot be reconstructed by the Worker. errorMessage contains the reconstruction failure and direction is panel-to-worker.

propertyWORKER

onrejectionhandled

js/worker.js:1102
onrejectionhandled: ?WorkerPromiseRejectionCallback = null

Handler for Promise rejections that later become handled.

propertyWORKER

onunhandledrejection

js/worker.js:1095
onunhandledrejection: ?WorkerPromiseRejectionCallback = null

Handler for newly unhandled Promise rejections.

propertyWORKERreadonly

performance

js/worker.js:1109
performance: Object

Worker-local performance timeline.

propertyWORKERreadonly

self

js/worker.js:1038
self: WorkerGlobalScope

The Worker global object itself.

methodWORKER

close

js/worker.js:1065
close()

Requests Worker shutdown from inside the Worker after the current task completes. Use this when Worker code itself knows that no more event-loop work is needed.

methodWORKER

postMessage

js/worker.js:1055
postMessage(data, transfer)

Serializes and sends a value from the Worker to its parent. Sender-side serialization and transfer-list validation are synchronous; successful delivery to the parent is asynchronous.

Parameters

NameTypeDescription
data*

Value to send.

transferoptional(Array<*>|Object)

Transfer list, either directly as an array or as an object containing { transfer: [...] }.

Throws

Error —

If the required data argument is omitted, the value cannot be structured-cloned, or the transfer list is invalid or cannot be committed. No message is queued and transferable source objects remain usable when this happens.