A Message object represents a single message on the message bus.
Messages can contain either a data payload or an error payload.
Messages can be a command, or a response. An error notification is always a response.
The content of the payload is opaque and its format is only decodable by the sender(s) and the receiver(s)
This has beeen simplified to remove TypeScript getters and setters, this is because, when using postMesssage()
and various other mechanisms because of The structured clone algorithm issue and deserialzing object properties.
You end up with an untyped object that only has the private properties ('_privateVar') exposed, none of the
methods either. Causes a dirty object that breaks most typed logic at runtime.
A Message object represents a single message on the message bus. Messages can contain either a data payload or an error payload. Messages can be a command, or a response. An error notification is always a response. The content of the payload is opaque and its format is only decodable by the sender(s) and the receiver(s)
This has beeen simplified to remove TypeScript getters and setters, this is because, when using postMesssage() and various other mechanisms because of The structured clone algorithm issue and deserialzing object properties. You end up with an untyped object that only has the private properties ('_privateVar') exposed, none of the methods either. Causes a dirty object that breaks most typed logic at runtime.
https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm