Standardize ES Worker
isiahmeadows at gmail.com
Mon Oct 31 12:42:17 UTC 2016
On Thu, Oct 27, 2016, 21:42 Boris Zbarsky <bzbarsky at mit.edu> wrote:
> On 10/27/16 6:18 PM, Isiah Meadows wrote:
> > 1. Add a new `import.fork(script): Promise<Worker>` method-like
> > expression that loads the worker and resolves when done/rejects if it
> > couldn't for some reason.
> What does "done" mean in this case?
When the worker has finished loading, so you can send and receive messages
> > - `worker.send(message, sharedBuffers?)` - Send a message and return a
> > Promise to its result.
> What if the "result" of the message is a sequence of messages back?
> This is a common thing to do with web workers: ask it to do something,
> and it sends the answer back in chunks.
The result is the value returned from the worker's `onMessage`. This does
permit async return values, because it's fairly common (at least in my
case) to send a message and expect a response as effectively a return
value, and I would like to reify that.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss