Standardize ES Worker

Isiah Meadows isiahmeadows at gmail.com
Mon Oct 31 12:42:17 UTC 2016


Inline

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.


> -Boris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20161031/0845fc44/attachment.html>


More information about the es-discuss mailing list