Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared workers #39

Open
jakearchibald opened this issue Feb 4, 2021 · 2 comments
Open

Shared workers #39

jakearchibald opened this issue Feb 4, 2021 · 2 comments
Labels
host environment Questions to be answered in each host environment

Comments

@jakearchibald
Copy link
Contributor

Can a module block be used to instantiate a shared worker?

const module = module { export default 42; }
cons myWorker = new SharedWorker(module, { type: 'module' });

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 😄.

@littledan littledan added the host environment Questions to be answered in each host environment label Feb 4, 2021
@surma
Copy link
Member

surma commented Feb 4, 2021

Yeah, I don’t think that will work, as every Module Block is unique. So it would effectively always refer to a different module.

@Akxe
Copy link

Akxe commented Apr 25, 2022

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 #45 is a possible solution to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
host environment Questions to be answered in each host environment
Projects
None yet
Development

No branches or pull requests

4 participants