W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

Re: Shared workers - use .source instead of .ports[0] ?

From: Jarred Nicholls <jarred@webkit.org>
Date: Tue, 10 Apr 2012 08:01:47 -0400
Message-ID: <CANufG2OPoqTEEDMAB8oFP5sAa_-2RfzA94dREhRSMeuMG-HP0Q@mail.gmail.com>
To: Simon Pieters <simonp@opera.com>
Cc: Jonas Sicking <jonas@sicking.cc>, "public-webapps@w3c.org" <public-webapps@w3c.org>
On Tue, Apr 10, 2012 at 1:20 AM, Simon Pieters <simonp@opera.com> wrote:

> On Wed, 04 Apr 2012 18:37:46 +0200, Jonas Sicking <jonas@sicking.cc>
> wrote:
>
>  Sounds great to me. The ports attribute is basically useless except in
>> this
>> one instance since ports are these days expose as part of structured
>> clones.
>>
>> Avoiding using it in this arguably weird way in this one instance seems
>> like a win to me.
>>
>
> I'd like to have an opinion from WebKit and Microsoft about this proposal.
> Can someone comment or cc relevant people, please?
>

FWIW this to me seems like a good improvement to the intuitiveness.  Since
a MessageEvent interface is being used, qualifying that *source* WindowProxy
is populated is all that's needed?


>
> cheers
>
>
>  / Jonas
>>
>> On Wednesday, April 4, 2012, Simon Pieters wrote:
>>
>>  Hi,
>>>
>>> In Opera Extensions we use something that resembles shared workers. One
>>> modification is that the 'connect' event's source port is exposed in
>>> .source instead of in .ports[0], to make it closer to the API for
>>> cross-document messaging. Maybe we should make this change to Shared
>>> Workers as well.
>>>
>>> I think shared workers hasn't seen wide adoption yet, so maybe changes
>>> like this are still possible.
>>>
>>> What do people think?
>>>
>>> currently:
>>> onconnect = function(e) { e.ports[0].postMessage('pong') }
>>>
>>> proposed change:
>>> onconnect = function(e) { e.source.postMessage('pong') }
>>>
>>> --
>>> Simon Pieters
>>> Opera Software
>>>
>>>
>>>
>
> --
> Simon Pieters
> Opera Software
>
>
Received on Tuesday, 10 April 2012 12:02:44 GMT

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