[whatwg] Workers proposal

Jonas Sicking jonas at sicking.cc
Thu Aug 21 09:12:50 PDT 2008


Ian Hickson wrote:
> 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?

Yeah, I don't feel strongly either way here. It feels "cleaner" to not 
have separate SharedWorker instances for each user of a shared worker, 
but there are also downsides with not doing that (like onerror and other 
future properties that we might want).

So I'm fine either way.

>> 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.

Ah, of course.

>> 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.

Sounds good to me.

/ Jonas



More information about the whatwg mailing list