W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: Synchronous postMessage for Workers?

From: David Levin <levin@chromium.org>
Date: Fri, 18 Nov 2011 08:50:15 -0800
Message-ID: <CACmjMJTYm_3pRa6erqz0xQ7v+y-nMJ1uPtBvQCtZCZ2xEX3yQQ@mail.gmail.com>
To: Glenn Maynard <glenn@zewt.org>
Cc: Jonas Sicking <jonas@sicking.cc>, Joshua Bell <jsbell@chromium.org>, public-webapps@w3.org
On Fri, Nov 18, 2011 at 8:16 AM, Glenn Maynard <glenn@zewt.org> wrote:

> On Thu, Nov 17, 2011 at 10:33 PM, David Levin <levin@chromium.org> wrote:
>
>> Ah so the proposal is really only adding a new method only
>> on DedicatedWorkerGlobalScope which send a synchronous message and
>> something corresponding on Worker which can respond to this.
>>
>
> There's no need for a new sending method; only a receiving method.  To
> reuse the original example:
>
>   postMessage({action: "prompt_user", prompt: "How about a nice game of
> chess?"});
>   var msg = waitForMessage();
>   if(msg && msg.data) { chess_game.begin(); }
>
> The other side is as usual:
>
>   worker.onmessage = function(e) { worker.postMessage(true); }
>
> without caring which API the worker is using to receive the response.
>

So the primary use case is code in the worker which has no other (async)
messages coming in?

dave
Received on Friday, 18 November 2011 16:51:04 GMT

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