Is it save to rely on the order of messages passed from the main thread to a single Web Worker being retained? For instance, if I do
worker.postMessage(1);
worker.postMessage(2);
will the worker certainly get to process the first message before the second one?
As long as you are working with the same worker to post the messages, I think it will. You can easily test this if you want. Make a loop and post messages with a certain order. If you always receive the messages in the same order as you post them, you can relay on it, that this will be the case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With