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

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

From: Anne van Kesteren <annevk@opera.com>
Date: Fri, 22 Jul 2011 00:42:38 +0200
To: "Andrei Popescu" <andreip@google.com>
Cc: Wojciech Masłowski <wmaslowski@opera.com>, "Bjoern Hoehrmann" <derhoermi@gmx.net>, public-geolocation <public-geolocation@w3.org>
Message-ID: <op.vyzqpcc664w2qv@annevk-macbookpro.local>
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:43:21 UTC

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