cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Gill (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CB-4610) locationerror event does not contain the three constants (TIMEOUT, PERMISSION_DENIED, POSITION_UNAVAILABLE)
Date Mon, 07 Oct 2013 23:08:42 GMT

     [ https://issues.apache.org/jira/browse/CB-4610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Steve Gill updated CB-4610:
---------------------------

    Assignee:     (was: Steve Gill)

> locationerror event does not contain the three constants (TIMEOUT, PERMISSION_DENIED,
POSITION_UNAVAILABLE)
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CB-4610
>                 URL: https://issues.apache.org/jira/browse/CB-4610
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Geolocation
>    Affects Versions: 2.3.0, 2.5.0, 2.9.0, 3.0.0
>         Environment: Mac Mountain Lion, iOS (any version)
>            Reporter: William Cheung
>
> In the PositionError code, three constants were defined.  However, they are not passed
back in getCurrentPosition's code below:
> var fail = function(e) {
>             clearTimeout(timeoutTimer.timer);
>             timeoutTimer.timer = null;
>             var err = new PositionError(e.code, e.message);
>             if (errorCallback) {
>                 errorCallback(err);
>             }
>         };
> This is due to PositionError.<some constants> wouldn't be available in "err" when
you instantiate (or new) PositionError.  Try to check the value of "err.TIMEOUT", for example,
and you'll get undefined.  This works if you are in a browser not using this plugin.  One
way to fix it is change the PositionError code to below:
> var PositionError = function(code, message) {
>     this.PERMISSION_DENIED = PositionError.PERMISSION_DENIED;
>     this.POSITION_UNAVAILABLE = PositionError.POSITION_UNAVAILABLE;
>     this.TIMEOUT = PositionError.TIMEOUT;
>     this.code = code || null;
>     this.message = message || '';
> };
> PositionError.PERMISSION_DENIED = 1;
> PositionError.POSITION_UNAVAILABLE = 2;
> PositionError.TIMEOUT = 3;



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message