postMessage
Summary
Posts a message to the worker with which the object is associated.
Method of apis/workers/Workerapis/workers/Worker
Syntax
object.postMessage(message, transfer);
Parameters
message
- Data-type
- any
This argument can be structured data, e.g.: worker.postMessage({opcode: 'activate', device: 1938, parameters: [23, 102]});
transfer
- Data-type
- any
(Optional)
Return Value
No return value
Notes
A message can be a JavaScript primitive, object, or array, but not a function.
Related specifications
- W3C Web Workers Specification
- W3C Editor’s Draft
Attributions
Microsoft Developer Network: Windows Internet Explorer API reference Article