Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
message (worker)
Collapse the table of content
Expand the table of content

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:
© 2015 Microsoft