How to only load worker once
I have a file that initialises a worker, and exports a function that posts a message to that worker. But if I import that function into multiple other files, the worker gets loaded each time. How can I prevent this to ensure only one instance of the worker is loaded, regardless of how many files I use the function in?
1 Reply
That seems fishy. Importing a file should only create a single instance. Do you have a code you can share?