W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2011

Re: addEventListener and side-effects

From: João Eiras <joaoe@opera.com>
Date: Tue, 06 Sep 2011 14:47:08 +0200
To: www-dom@w3.org
Message-ID: <op.v1d0gur72q99of@joaoe>
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

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:18 UTC