cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhigg...@apache.org
Subject git commit: CB-5729 [BlackBerry10] Update GeolocationProxy to return collapsed object
Date Mon, 06 Jan 2014 16:01:16 GMT
Updated Branches:
  refs/heads/dev 8a8aa20b7 -> f2a355d32


CB-5729 [BlackBerry10] Update GeolocationProxy to return collapsed object


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/commit/f2a355d3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/tree/f2a355d3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/diff/f2a355d3

Branch: refs/heads/dev
Commit: f2a355d32b9014520a054a595fa8b372fabaf763
Parents: 8a8aa20
Author: Bryan Higgins <bhiggins@blackberry.com>
Authored: Mon Jan 6 11:02:57 2014 -0500
Committer: Bryan Higgins <bhiggins@blackberry.com>
Committed: Mon Jan 6 11:02:57 2014 -0500

----------------------------------------------------------------------
 www/blackberry10/GeolocationProxy.js | 34 +++++++++++++++++++------------
 1 file changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/blob/f2a355d3/www/blackberry10/GeolocationProxy.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/GeolocationProxy.js b/www/blackberry10/GeolocationProxy.js
index 6428942..0bba226 100644
--- a/www/blackberry10/GeolocationProxy.js
+++ b/www/blackberry10/GeolocationProxy.js
@@ -19,14 +19,19 @@
  *
 */
 
-var idsMap = {};
+var idsMap = {},
+    geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation');
 
 module.exports = {
+
     getLocation: function(success, error, args) {
-        var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation'),
-            successCallback = function (position) {
-                success(position.coords);
-            };
+        var successCallback = function (result) {
+            var pos = result.coords;
+            pos.timestamp = result.timestamp;
+            if (success) {
+                success(pos);
+            }
+        };
         geo.getCurrentPosition(successCallback, error, {
             enableHighAccuracy: args[0],
             maximumAge: args[1]
@@ -34,28 +39,31 @@ module.exports = {
     },
 
     addWatch: function(success, error, args) {
-        var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation'),
-            id = args[0],
-            nativeId = geo.watchPosition(success, error, {
+        var id = args[0],
+            successCallback = function (result) {
+                var pos = result.coords;
+                pos.timestamp = result.timestamp;
+                if (success) {
+                    success(pos);
+                }
+            },
+            nativeId = geo.watchPosition(successCallback, error, {
                 enableHighAccuracy: args[1]
             });
-
         idsMap[id] = nativeId;
     },
 
     clearWatch: function(success, error, args) {
-        var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation'),
-            id = args[0];
-
+        var id = args[0];
         if(id in idsMap) {
             geo.clearWatch(idsMap[id]);
             delete idsMap[id];
         }
-
         if(success) {
             success();
         }
     }
+
 };
 
 require("cordova/exec/proxy").add("Geolocation", module.exports);


Mime
View raw message