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

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

From: Doug Turner <doug.turner@gmail.com>
Date: Thu, 21 Jul 2011 17:39:53 -0700
Cc: (wrong string) ‚owski <wmaslowski@opera.com>, Bjoern Hoehrmann <derhoermi@gmx.net>, public-geolocation <public-geolocation@w3.org>
Message-Id: <FF7E8E24-AB1C-4376-BFA8-3D87E7A52C82@gmail.com>
To: Andrei Popescu <andreip@google.com>
Using the Android or IOS device APIs, in this case, I continue to see small amounts of movement.  Maybe this is a theortical question (which I am not very interested in), or there is a lot of noise that isn't filtered out by the platform.  Do you see the same thing, Andrei?

In any case, I don't think we want to add different events for "present" state.  Instead, I think it is completely fine to just fire an onchange for new listeners.

Doug 

On Jul 21, 2011, at 4:40 PM, Andrei Popescu wrote:

> What happens if the device (say, a tablet) is lying still on a table?
> If I load a Web page that uses this API to show a compass UI, the page
> won't get any events until I move the tablet around. I'm not sure this
> is acceptable?
> 
> Andrei
> 
> On Thu, Jul 21, 2011 at 3:54 PM, Doug Turner <doug.turner@gmail.com> wrote:
>> 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 Friday, 22 July 2011 00:40:24 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:51:02 UTC