[whatwg] Workers feedback

Ian Hickson ian at hixie.ch
Fri Aug 8 10:36:55 PDT 2008


On Fri, 8 Aug 2008, Jonas Sicking wrote:
>
> So the API I'm proposing is the following:

This seems to be a strict subset of what the spec has now; the only 
difference being that there's no easy way to create a worker and then pass 
it to someone else to take care of, and there seems to be no easy way for 
a worker to hear about a new "parent".

> (We might want to add an onconnect property to WorkerGlobalScope, but it 
> doesn't seem strictly needed)

How else would you connect to a shared worker?


> I think that it has the following advantages over the current draft spec:
> 
> * We don't expose users to MessagePort objects in the majority of
>   scenarios.

I do not consider this an advantage. All we're doing is moving the 
complexity to a later point -- instead of learning part of the API and 
then more of the API if they want to, authors have to learn two APIs, one 
of which is just as complicated as today's, and another that is not quite 
the same as either Window.postMessage() or port.postMessage() but is 
similar enough to get them confused.


> * There is no permanent .port properties anywhere that would go dead if
>   the port is passed somewhere.

The .parent property is as likely to go dead, e.g. if the parent goes away 
after the worker has been provided a port to another window.


> * There is no need for pseudo properties anywhere (the port variable
>   inside the WorkerGlobalScript)

Replacing 'port' with 'parent' doesn't really change much. :-)


> * The current draft duplicates the onunload property on both the
>   worker and its port. Not sure if this is needed or just a bug.

It's not strictly needed but it's useful to distinguish the death of the 
port from the death of the worker.


> * All onX objects live on the same object rather than some living
>   on the worker, some living on worker.port.

They still also live on .port, it's just that you're not exposing this 
explicitly now. This is a false simplification IMHO.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list