web workers on crack! (should have called it whitney)
The goal behind workhorse is to simplify messaging between a worker and client interface. It also adopts some concepts from the ServiceWorker spec.
var worker = 'thing.js';worker;
// remove all the "wats"worker;
worker;worker; // => "hi!"
worker;worker; // => "hi!"worker; // nothin'
What are the differences between
postsends a message across the wire, this would be the equivilant of
emittriggers any and all event handlers associated with an event. This does not send a message across the wire.
Responding to events
By default web workers offer a very simple messaging system which can get messy quick when a worker potentially has multiple responsibilities.
Rather than wiring up multiple events for a game of ping pong, we should be able to easily respond to an event via the
So just like the issue of responding to events, how does a client recieve that response without wiring up an additional event? This seems like a fitting place to use promises.
Things to consider while developing
- There are multiple types of workers (Worker, SharedWorker, etc.)
- It's possible to spin up a worker via
- Nothing could probably ever take Whitney in a fist fight