[whatwg] Workers and addEventListener

Ian Hickson ian at hixie.ch
Thu Oct 15 14:24:39 PDT 2009

On Thu, 15 Oct 2009, Drew Wilson wrote:
> To be absolutely clear (since there's some confusion about whether we 
> are talking about explicit MessagePorts, or about implicit ports for 
> dedicated workers). Are you saying that this:
> var channel = new MessageChannel();
> channel.port1.postMessage("hi mom");
> channel.port2.addEventListener("message", function(event)
> {alert(event.data); }, false);
> Should result in an alert dialog being fired?

Nope, this case should not get an event fired.

> I would not be opposed to changing the spec to include enabling a port's 
> message queue when addEventListener("message") is invoked.

I'm reluctant to make addEventListener() do magic.

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