Skip to content

Worker.onMessage ​

JS
    Worker.onMessage(function callback)

Listens for the event of messages sent to the current thread by the main thread / worker thread.

Parameters

  • function callback: Callback function for the event of messages sent to the current thread by the main thread / worker thread.

Parameters of the callback function

  • Object res: Returns the message sent to the current thread by the main thread / worker thread.

Properties of res:

PropertyValue TypeDescription
messageObjectThe message sent to the current thread by the main thread / worker thread