Combine Browser and WebWorker

I use a browser to pack my application and use js files as modules.

Now I want to use webworker to download a very large file in the background.

The problem is that to create this working team

new Worker('./worker.js')

should get the js file name. So this file cannot be a module. I think this makes my application much more complex, because now I need to combine the two ways to use js files.

On the other hand, I am also interested in access to the browser module from this working one.

So the question is, what is the best way to use a browser and web workers together?

+4
source share
1 answer
+4

All Articles