Conversation
It accepts a single argument. Fixes: #556
| postMessage(...args) { | ||
| this[kWorker].postMessage(args); | ||
| postMessage(message) { | ||
| this[kWorker].postMessage(message); |
There was a problem hiding this comment.
I also found this morning that this was the problem when a message is sent to the worker.
The only downside of the proposed fix, is that, if a lib wants to make use of the transfer feature, the call will fail because you only accept one argument. The fact that this feature is not implemented is not a big problem, because it is just related to scope and gc I guess.
Consequently, just in case, I would add the second argument, even if not used.
I was currently elaborating that solution, but also a "better" test for the Worker, that check that indeed the message is well transmitter and received (with an Worker that do an echo)
There was a problem hiding this comment.
It won't fail, the argument will be ignored. You can pass as many parameters as you want.
There was a problem hiding this comment.
Let me know if I should create a PR with what I propose or not
There was a problem hiding this comment.
It won't fail, the argument will be ignored. You can pass as many parameters as you want.
Ok fine, good to know!
There was a problem hiding this comment.
Let me know if I should create a PR with what I propose or not
Adding transfer list support requires structured cloning, which is alas not as straightforward as I thought.
For now this should do, but I'd like have transfer support in the future.
There was a problem hiding this comment.
Yeah I won't be able to implement that 😅
|
That fix works for me |
It accepts a single argument.
Fixes: #556