Open jakearchibald opened 3 years ago
Yeah, I donโt think that will work, as every Module Block is unique. So it would effectively always refer to a different module.
I would love for this to be a thing. If the normal Worker
would get this special treatment and SharedWorker
would not, then I think the SharedWorker
would be deprecated very soon: As it stands now, even though they are not too different the SharedWorker
browser adaptation is tragic compared to the normal one.
Can a module block be used to instantiate a shared worker?
What about ServiceWorker
?
May I ask, do you oppose the idea, or do you just don't think is too complicated?
I think that the https://github.com/tc39/proposal-js-module-blocks/issues/45 is a possible solution to this.
Can a module block be used to instantiate a shared worker?
My gut feeling is 'no', since the only way two pages could share a shared worker is by sharing the module via
postMessage
. That also means that two origins could end up sharing the same worker which is new and terrifying ๐.