postMessage method
Sends a message from the worker to the parent thread.
Syntax
object.postMessage(data, ports)Parameters
- data [in]
-
Type: any
One of the following:
- JavaScript primitive, such as a string
- object
- Array
- PixelArray object
- ImageData object
- Blob
- File
- ArrayBuffer
postMessage cannot send a function as a message.
- ports [optional]
-
Type: any
Return value
This method does not return a value.
Remarks
A message can be a JavaScript primitive, object, or array, but not a function.
See also
Show: