[whatwg] Question regarding event: in server-sent events

Thanks for the clarifications, this helps a lot.

-Nicholas
 
______________________________________________
Commander Lock: "Dammit Morpheus, not everyone believes what you believe!"
Morpheus: "My beliefs do not require them to."

-----Original Message-----
From: Anne van Kesteren [mailto:annevk@opera.com] 
Sent: Tuesday, October 19, 2010 12:54 AM
To: whatwg at whatwg.org; Nicholas Zakas
Subject: Re: [whatwg] Question regarding event: in server-sent events

On Mon, 18 Oct 2010 19:38:46 +0200, Nicholas Zakas <nzakas at yahoo-inc.com>  
wrote:
> Just for my own understanding, what you're saying is:
>
> 1) Any event name in the stream must be a valid event name in that it  
> must not have spaces, special characters, etc. (The wording in the spec  
> made me think that it must be an event name that is listed in the DOM  
> Events spec, such as click.)

Yes, although it is not clear whether per the current DOM Events  
specification an event name with a space would be invalid.


> 2) When you define an custom event name, this still fires the message  
> event with event.type set to the custom event name.

Well, it dispatches an event that uses the MessageEvent interface. But  
e.g. a function attached to onmessage will not be invoked, as the event is  
not named message, but something else. So you need  
obj.addEventListener(customEvent, ...).


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Tuesday, 19 October 2010 09:58:34 UTC