Re: Synchronous postMessage for Workers?

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 UTC