W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

Re: Synchronous postMessage for Workers?

From: Mark S. Miller <erights@google.com>
Date: Tue, 14 Feb 2012 17:57:44 -0800
Message-ID: <CABHxS9gJqMz0AY2wm8eMvmvahSKd2mHq_=DN8G3Ny59M2QhV-Q@mail.gmail.com>
To: John J Barton <johnjbarton@johnjbarton.com>
Cc: Ian Hickson <ian@hixie.ch>, Joshua Bell <jsbell@chromium.org>, Jonas Sicking <jonas@sicking.cc>, public-webapps@w3.org, David Levin <levin@chromium.org>
On Mon, Feb 13, 2012 at 12:08 PM, John J Barton <johnjbarton@johnjbarton.com
> wrote:

> On Mon, Feb 13, 2012 at 11:44 AM, Ian Hickson <ian@hixie.ch> wrote:
> > On Thu, 17 Nov 2011, Joshua Bell wrote:
> >>
> >> Wouldn't it be lovely if the Worker script could simply make a
> >> synchronous call to fetch data from the Window?
> >
> > It wouldn't be so much a synchronous call, so much as a blocking get.
> >..
> > Anyone object to me adding something like this? Are there any better
> > solutions? Should we just tell authors to get used to the async style?
>
> I guess the "Q" folks would say that remote promises provides another
> solution. If promises are adopted by the platform, then the async
> style gets much easier to work with.
> https://github.com/kriskowal/q
> (spec is somewhere on the es wiki)
>

<http://wiki.ecmascript.org/doku.php?id=strawman:concurrency>

This spec doesn't quite correspond to Kris' implementation. We're still
working that out. John's "then" below corresponds to "when" on the wiki
page.


>
> In the Q model you would fetch data like:
>  parentWindow.fetchData('myQueryString').then(  // block until reply.
>    function(data) {...},
>    function(err) {...}
>  );
> Q has functions to join promises; q_comm add remote promises.
>
> I believe this can be done today with q_comm in workers.
>
> Your signal/yieldUntil looks like what es-discuss calls "generators".
> I found them much harder to understand than promises, but then I come
> from JS not python.
>
> jjb
>
>


-- 
    Cheers,
    --MarkM
Received on Wednesday, 15 February 2012 01:58:13 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:50 GMT