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

Re: Synchronous postMessage for Workers?

From: John J Barton <johnjbarton@johnjbarton.com>
Date: Mon, 13 Feb 2012 12:08:10 -0800
Message-ID: <CAFAtnWxuN1qzHLbEH=8MOpiA+PQpxPhDoD_NSdGeNg6e1BiKHg@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: 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 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.
(spec is somewhere on the es wiki)

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.

Received on Monday, 13 February 2012 20:08:37 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:31 UTC