Here is a quick overview, in case you don't know much about them:
Let me translate this for you: Worker threads are a pain to even package in their own files, you can't call something like:
No, that would be too easy, since from that method I could be able to access shared state, so let's make it awkward and weird, why not:
and from the new file call:
All the libraries, that you use both in your worker, or in your main code? Better load them twice.
But wait, there's more!
There is a new object visible named self, that is the worker reference (if it's a script inside a window, self == window).
So let's say you would want to process async a bunch of data, whenever it's being sent from the parent - again, there is no shared context, well why not go with:
Looks simple, isn't it? Except it's in a different bloody file, and did I mentioned that breakpoints in the worker thread code don't stop?