[whatwg] Workers proposal

Ian Hickson ian at hixie.ch
Wed Aug 20 23:21:46 PDT 2008

On Wed, 20 Aug 2008, Jonas Sicking wrote:
> Do we really need the SharedWorker interface. I.e. couldn't we just 
> return a MessagePort?

We could. It would mean either putting onerror on all message ports, or 
not reporting error information for shared workers. Actually even if we 
did put onerror on ports, it would be difficult to define which ports 
actually get the error events.

It would also mean not using a constructor, but that's fine.

Finally, it would make extending the interface later much harder if we 
found that it was useful to allow different users of the shared worker to 
control something.

Anyone else have any opinions on this?

> This would probably require that we use a factory function rather than a 
> constructor, like "getPortForSharedWorker" or some such. In other words, 
> do we really need onclose and onerror for shared workers (onerror seems 
> to make some sense, onclose i'm less sure about).

I don't mind dropping them.

> I think startConversation makes as much sense on shared workers as 
> dedicated ones, so moving that API up to Worker/WorkerGlobalScope seems 
> like a good idea.

startConversation is on the port(s) in the shared worker case. I'm not 
sure what it would mean on the worker or global scope in the shared case, 
since there's no target without the port in that case.

> If we keep the constructors (see first paragraph), I would prefer the 
> syntax "new Worker" over "new DedicatedWorker".

That's fine, I can change the base to be AbstractWorker and then have 
Worker and SharedWorker as the interfaces inheriting from it.

I'll wait for slightly more input and then update the spec.

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