

Intro to JS Web Workers - brian_cooksey
https://zapier.com/engineering/intro-to-web-workers/

======
gliese1337
Inlining a worker with an ObjectURL is brilliant. It nicely solves the issue
of worker script urls being resolved relative to the page, rather than
relative to the URL of the calling script. I had previously solved that
problem just by having the parent script read a global variable with the
proper absolute path to the worker's location, but this is much nicer.

~~~
camus
gosh , it's a killer trick!

------
VeejayRampay
Web Workers are a good example of those new technologies that the HTML5
Javascript APIs expose to programmers that we don't really have found a real-
life use for as of now...

Just like WebSockets really, you can feel the obvious potential but I have yet
to encounter a good example of how Web Workers will help the average web
developer to solve his problems in a more efficient or elegant manner.

The fact that they can't manipulate the DOM in a simple way is probably one of
the reasons why they haven't crossed the mainstream line. That or the still
approximative support across browsers.

Or maybe it's just that they're too much of a game changer and we've yet to
wrap our heads around their power. I don't know...

~~~
jwoah12
My side project[1] is an interactive table component that allows the user to
provide the table data through an arbitrary callback. I allow the use to
either pass an actual function or a reference to inline code that will be
instantiated as a web worker. I figure there may be a case in which the user
is creating the dataset in some expensive way, but it can happen in a separate
thread and not tie up the UI. Then the worker passes the final data back to
the UI thread to render. It would make sense that any intensive calculations
should happen on the server, but I wanted to leave the option open.

[1] - [http://jarwol.com/aTable/](http://jarwol.com/aTable/)

------
jwoah12
I use Blobs to instantiate workers in one of my side projects, and it has
always made me wonder: Why isn't the option to instantiate a web worker using
inline code built in to the browser APIs?

------
Everlag
Why is this being upvoted? I will say it is a well written tutorial but the
content is basically completely stripped from html5rocks. There is an
overabundance of sites with this topic and a simple google will reveal that.

I happen to know this because I was starting to use web workers about 6 hours
ago. And yes, html5rocks does include the blob trick.

~~~
lobo_tuerto
Where is your contribution? Usually if someone have better resources than the
one submitted they post an array of links to these curated info.

------
bhauer
That is a great summary. Thank you for writing this up!

Even without the context of minification, I like your use of Blobs to
instantiate a Web Worker.

------
nej
Multi-threaded JavaScript sounds so dreamy

