Does web worker reload the imported module every time?

Viewed 33

When I am reading a opensource project using web worker, I found that once a module is imported by the worker, then call to the imported module will cause reload of the whole module.

For example, main thread:

a.js

const  T = new Date().getTime(); //init the variable once the moudle is loaded
export default T;

worker.js:

import T from a;

const a  = T; // this will result in different value for the varible `T`

Is this the desired implemention? How to avoid this or if I can to get the global-initiated varible inside a worker ?

0 Answers
Related