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

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

From: Simon Pieters <simonp@opera.com>
Date: Wed, 04 Apr 2012 17:25:35 +0200
To: "public-webapps@w3c.org" <public-webapps@w3c.org>
Message-ID: <op.wb8ygxe3idj3kv@simons-macbook-pro.local>

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?

onconnect = function(e) { e.ports[0].postMessage('pong') }

proposed change:
onconnect = function(e) { e.source.postMessage('pong') }

Simon Pieters
Opera Software
Received on Wednesday, 4 April 2012 15:26:13 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:40 UTC