This same problem was addressed some time ago because Godot supported multi-threading in web games years ago.
Read this:
https://itch.io/t/2025776/experimental-sharedarraybuffer-support
However, from what I've read from various people, it's best not to use multi-threading, as sooner or later it will cause compatibility issues with different users.