SkepticMysticS
Denoβ€’17mo agoβ€’
1 reply
SkepticMystic

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?
Was this page helpful?