W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2010

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

From: Anne van Kesteren <annevk@opera.com>
Date: Tue, 19 Oct 2010 09:54:12 +0200
Message-ID: <op.vktb8mcq64w2qv@anne-van-kesterens-macbook-pro.local>
On Mon, 18 Oct 2010 19:38:46 +0200, Nicholas Zakas <nzakas at yahoo-inc.com>  
> 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
Received on Tuesday, 19 October 2010 00:54:12 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:01 UTC