
Show HN: Chrome v83 enables JavaScript module support for SharedWorkers - tobiu
https://medium.com/@tobiasuhlig/chrome-v83-enables-js-module-support-for-sharedworkers-starting-a-new-era-for-multi-browser-dbb20366bddf
======
tobiu
Some ideas in general:

The article is about putting a framework & your Apps into a separate thread
(calling this one App worker).

Now, with SharedWorkers being fully supported, we can connect multiple main
threads to a shared App worker. This way Apps live within the same realm and
can directly communicate. They even share the virtual dom, leading to really
great possibilities (moving dom nodes from one App to another).

E.g. if you would like to create a multi screen trading App, there is a big
potential to speed up things.

On mobile this could also get interesting: imagine a native App with multiple
WebViews. Those could as well share code and communicate directly.

Even in case there is just one browser window, the default worker setup (non
shared workers) can make an impact.

------
tobiu
Published v1.2.5 on npm:
[https://neomjs.github.io/pages/](https://neomjs.github.io/pages/)

SharedWorkers examples are online. Dev mode: Chrome v83+ Webpack Dist
versions: Chrome & Firefox(!)

Enjoy!

A release announcement will follow soon.

In Chrome: open the example, then open chrome://inspect/#workers

inside another tab to see the SharedWorkers. The webpack based dist version
supporting Firefox is really impressive.

In FF, open a new tab and open: about:debugging#/runtime/this-firefox

------
mhoad
I recently came across a talk on YouTube from Chrome Dev Summit a couple of
years ago that covered a very similar pattern to the one shown here that I
would recommend checking out
[https://www.youtube.com/watch?v=Vg60lf92EkM](https://www.youtube.com/watch?v=Vg60lf92EkM)
and I am honestly kind of surprised it isn't more popular.

~~~
tobiu
I did not see this one yet, thanks for sharing! (Watching it now)

------
mleonard
Great news. Just waiting for es module support in service workers now!

