Closed jayantbh closed 4 years ago
Sorry, this project is just a demo.
I will accept and release PRs, but can’t help you with issue investigation.
My bad. The issue was because of my own code.
In the worker, I was calling postMessage
with only 1 arg. The message.
This worked fine on Chrome, but broke on Safari.
The fix was to just do this instead:
postMessage(messageObj, window.location.origin)
.
So, the issue wasn't happening because of worker.post({ message })
, but because of a postMessage
that would be fired when the worker.post
was received in the worker.
Thanks for this project. Works pretty well for me!
This raised a different issue.
In the non-worker code, the MessageEvents for workers are never fired. That is, the listener to createWorker
didn't work. But, you've mentioned that this was a demo project, so, won't file an issue for that.
Thanks for your work! :)
On doing a
worker.post({ message })
, Safari throws this error. Chrome doesn't.I think it's because
postMessage
expects atargetOrigin
parameter to be supplied. But needs a deeper look.