Re: Spec update: deviceorientation event should fire when listener is first registered

On Tue, 12 Jul 2011 13:42:36 +0200, Andrei Popescu <andreip@google.com>  
wrote:
> On Tue, Jul 12, 2011 at 12:41 PM, Anne van Kesteren <annevk@opera.com>  
> wrote:
>> I think firing when a new listener registers for the event is wrong.  
>> Tying that together goes against the event model. addEventListener()  
>> has no such side effects.
>
> What exactly is it wrong with it? And what alternative would you
> suggest to solve the given problem?

You could follow a similar design to http://www.whatwg.org/C#messageport  
that does have special handling for onmessage (or here  
ondeviceorientation), but not for addEventListener(). If you want to use  
addEventListener() you would have to invoke start().

The problem is that addEventListener() is supposed to be orthogonal to all  
this. We could change that, but I am not convinced it is a good idea.


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

Received on Tuesday, 12 July 2011 11:51:26 UTC