Export (0) Print
Expand All

onmessage event

Returns a message from the parent thread to the worker thread, or between two MessagePort objects.

Syntax

HTML Attribute <element onmessage = "handler(event)">
addEventListener Method object.addEventListener("message", handler, useCapture)

Event handler parameters

val [in]

Type: Function

Function to handle message event.

Remarks

When the parent thread uses postMessage to send a message to the worker or MessagePort object, this event will allow the worker or window to read the message. The data object of the MessageEvent object will contain a clone of the message.

See also

MessagePort
Worker
WorkerGlobalScope

 

 

Show:
© 2014 Microsoft