Re: addEventListener and side-effects

On Tue, 06 Sep 2011 13:41:22 +0200, Robin Berjon <robin@berjon.com> wrote:

> Dear www-dom,
>
> as most of you are probably aware, there have been recent threads on  
> both the Geo list[0] and the DAP list[1][2] about calls to  
> addEventListener producing side-effects (or purported side-effects).
>
> In both cases we have a situation in which registering an event using  
> addEventListener() is said to immediately (but asynchronously) trigger  
> an event for the given event type. The advantage is clear: it provides  
> the author with immediate information about (respectively) device  
> orientation and battery status, without requiring one to encumber the  
> API with an extra method just to get information that is expected to be  
> otherwise provided through events. However there is disagreement about  
> whether such behaviour constitutes a side-effect that reaches beyond  
> what event registration ought to perform or not.

I find it very trivial to specify the event to fire immediately  
registration of a listener, and really a non-issue.

What differentiates the event dispatched right after registration or the  
others ? They are the same and it's completely transparent.

Received on Tuesday, 6 September 2011 12:47:37 UTC