Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Chrome v83 enables JavaScript module support for SharedWorkers (medium.com)
10 points by tobiu 28 days ago | hide | past | web | favorite | 5 comments

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.

Published v1.2.5 on npm: https://neomjs.github.io/pages/

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


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

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 and I am honestly kind of surprised it isn't more popular.

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

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

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact