Re: Drop lastPosition from Geolocation?

On Wed, Nov 19, 2008 at 5:52 PM, Doug Turner <doug.turner@gmail.com> wrote:
>
> On Nov 19, 2008, at 9:43 AM, Andrei Popescu wrote:
>
>> Hi Doug,
>>
>> I like the modifiedSince option, but I do have a question. Right now,
>> lastPosition allows you to quickly fallback to some default action if
>> lastPositon is null or too old.
>>
>> In the async solution, the only way to achieve the same thing is by
>> both specifying modifiedSince and setting timeout to 0, right? This
>> would force the UA to immediately invoke the errorCallback (with error
>> TIMEOUT or POSITION_UNAVAILABLE?) in case it does not have a fresh
>> enough cached position. What happens if the page does not have
>> permission? I think the errorCallback should be immediately invoked
>> with error PERMISSION_ERR, right?
>
>
> Right, if the document isn't given permission to use navigator.geolocation,
> then the errorCallback, if set, will be called with the PERMISSION_DENIED
> error code.
>

Ok, so for the following call

geolocation.getCurrentPermission(successCallback, errorCallback,
{modifiedSince:600, timeout:0});

the new behavior is the following:

- if the page has no permission, errorCallback is invoked with
PERMISSION_DENIED.
- else
  * if it doesn't have any cached position, errorCallback is invoked
with POSITION_UNAVAILABLE.
  * else
     ** if the cached position is older than 10 mins, errorCallback is
invoked with POSITION_UNAVAILABLE
     ** else successCallback is immediately invoked with the cached position

Andrei

Received on Wednesday, 19 November 2008 18:03:58 UTC