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

i don't see the point, really.  for device orientation, the interval between movements -- especially on a precise device -- is very small (< .10s).  Because of this, I don't think you need a separate event for the initial value.


On Jul 21, 2011, at 3:42 PM, Anne van Kesteren wrote:

> On Thu, 21 Jul 2011 19:00:45 +0200, Andrei Popescu <andreip@google.com> wrote:
>> Thinking about this some more, I was wondering if there's any merit to
>> the following idea:
>> 
>> - we could have a new "getDeviceOrientation()" method on the navigator
>> object. This method synchronously returns an object that is an
>> EventTarget:
>> 
>> var o = navigator.getDeviceOrientation();
>> 
>> - this object is then the target of device orientation events:
>> 
>> o.addEventListener("initial", function(event) { ... });
>> o.addEventListener("change", function...);
>> o.addEventListener("error", function...);
>> 
>> This design solves the problem by having the "getDeviceOrientation()"
>> function be the one that triggers the initial event. I think it also
>> solves the problem brought up by Bjoern. Furthermore, there is a
>> precedent for this design in the Indexed Database specification:
>> 
>> http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#request-api
>> 
>> What do you think?
> 
> Looks good to me. If this is synchronous anyway maybe this should just be an attribute.
> 
> 
> 
> -- 
> Anne van Kesteren
> http://annevankesteren.nl/
> 

Received on Thursday, 21 July 2011 22:54:38 UTC