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

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

From: Andrei Popescu <andreip@google.com>
Date: Thu, 21 Jul 2011 16:40:01 -0700
Message-ID: <CAGn1-_UAeNheBhgB=7LZpuV8xFfLMD-W1HxmsTTqqkugh3eGxw@mail.gmail.com>
To: Doug Turner <doug.turner@gmail.com>
Cc: (wrong string) Ĺ‚owski <wmaslowski@opera.com>, Bjoern Hoehrmann <derhoermi@gmx.net>, public-geolocation <public-geolocation@w3.org>
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 Thursday, 21 July 2011 23:40:27 UTC

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