W3C home > Mailing lists > Public > public-device-apis@w3.org > July 2011

Event firing [Fwd: Re: Spec update: deviceorientation event should fire when listener is first registered]

From: Dominique Hazael-Massieux <dom@w3.org>
Date: Tue, 12 Jul 2011 15:42:38 +0200
To: public-device-apis@w3.org
Message-ID: <1310478165.2309.140.camel@altostratustier>
Hi,

There is a thread in the Geolocation WG about how to properly spec up
firing events as soon as possible (in the context of the device
orientation spec):
http://lists.w3.org/Archives/Public/public-geolocation/2011Jul/thread.html#msg25

We should watch it, and most likely apply the conclusions to the Battery
status events:
        "When an event listener is registered with the event type
        batterystatus, then the user agent must retrieve the relevant
        information and dispatch a BatteryStatusEvent event
        asynchronously"
http://dev.w3.org/2009/dap/system-info/battery-status.html#the-batterystatus---------event

Dom

-------- Message transféré --------
> De: Dean Jackson <dino@apple.com>
> À: Anne van Kesteren <annevk@opera.com>
> Cc: Andrei Popescu <andreip@google.com>, Doug Turner
> <doug.turner@gmail.com>, Steve Block <steveblock@google.com>,
> public-geolocation <public-geolocation@w3.org>
> Sujet: Re: Spec update: deviceorientation event should fire when
> listener is first registered
> Date: Tue, 12 Jul 2011 23:17:20 +1000
> 
> On 12/07/2011, at 9:50 PM, Anne van Kesteren wrote:
> 
> > 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.
> 
> I tend to agree with Anne here. We shouldn't change the understood behaviour of addEventListener(). If you really need an event to be fired, then we should expose a mechanism specifically for that.
> 
> Dean
> 
> 
> 
Received on Tuesday, 12 July 2011 13:42:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:14:21 GMT