summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/cordova-plugin-geolocation/www
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-geolocation/www')
-rw-r--r--StoneIsland/plugins/cordova-plugin-geolocation/www/Coordinates.js2
-rw-r--r--StoneIsland/plugins/cordova-plugin-geolocation/www/Position.js2
-rw-r--r--StoneIsland/plugins/cordova-plugin-geolocation/www/PositionError.js2
-rw-r--r--StoneIsland/plugins/cordova-plugin-geolocation/www/android/geolocation.js34
-rw-r--r--StoneIsland/plugins/cordova-plugin-geolocation/www/blackberry10/GeolocationProxy.js69
-rw-r--r--StoneIsland/plugins/cordova-plugin-geolocation/www/geolocation.js78
6 files changed, 59 insertions, 128 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-geolocation/www/Coordinates.js b/StoneIsland/plugins/cordova-plugin-geolocation/www/Coordinates.js
index 84fdd5b8..1d7e8794 100644
--- a/StoneIsland/plugins/cordova-plugin-geolocation/www/Coordinates.js
+++ b/StoneIsland/plugins/cordova-plugin-geolocation/www/Coordinates.js
@@ -30,7 +30,7 @@
* @param {Object} altacc
* @constructor
*/
-var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) {
+var Coordinates = function (lat, lng, alt, acc, head, vel, altacc) {
/**
* The latitude of the position.
*/
diff --git a/StoneIsland/plugins/cordova-plugin-geolocation/www/Position.js b/StoneIsland/plugins/cordova-plugin-geolocation/www/Position.js
index d6b2c0cc..b4f20e07 100644
--- a/StoneIsland/plugins/cordova-plugin-geolocation/www/Position.js
+++ b/StoneIsland/plugins/cordova-plugin-geolocation/www/Position.js
@@ -21,7 +21,7 @@
var Coordinates = require('./Coordinates');
-var Position = function(coords, timestamp) {
+var Position = function (coords, timestamp) {
if (coords) {
this.coords = new Coordinates(coords.latitude, coords.longitude, coords.altitude, coords.accuracy, coords.heading, coords.velocity, coords.altitudeAccuracy);
} else {
diff --git a/StoneIsland/plugins/cordova-plugin-geolocation/www/PositionError.js b/StoneIsland/plugins/cordova-plugin-geolocation/www/PositionError.js
index 94562407..476b322a 100644
--- a/StoneIsland/plugins/cordova-plugin-geolocation/www/PositionError.js
+++ b/StoneIsland/plugins/cordova-plugin-geolocation/www/PositionError.js
@@ -26,7 +26,7 @@
* @param code
* @param message
*/
-var PositionError = function(code, message) {
+var PositionError = function (code, message) {
this.code = code || null;
this.message = message || '';
};
diff --git a/StoneIsland/plugins/cordova-plugin-geolocation/www/android/geolocation.js b/StoneIsland/plugins/cordova-plugin-geolocation/www/android/geolocation.js
index 7265bec0..54005545 100644
--- a/StoneIsland/plugins/cordova-plugin-geolocation/www/android/geolocation.js
+++ b/StoneIsland/plugins/cordova-plugin-geolocation/www/android/geolocation.js
@@ -19,7 +19,7 @@
*
*/
-var exec = cordova.require('cordova/exec');
+var exec = cordova.require('cordova/exec'); // eslint-disable-line no-undef
var utils = require('cordova/utils');
var PositionError = require('./PositionError');
@@ -28,44 +28,44 @@ var PositionError = require('./PositionError');
var pluginToNativeWatchMap = {};
module.exports = {
- getCurrentPosition: function(success, error, args) {
- var win = function() {
- var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation');
- geo.getCurrentPosition(success, error, args);
+ getCurrentPosition: function (success, error, args) {
+ var win = function () {
+ var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation'); // eslint-disable-line no-undef
+ geo.getCurrentPosition(success, error, args);
};
- var fail = function() {
+ var fail = function () {
if (error) {
- error(new PositionError (PositionError.PERMISSION_DENIED, 'Illegal Access'));
+ error(new PositionError(PositionError.PERMISSION_DENIED, 'Illegal Access'));
}
};
- exec(win, fail, "Geolocation", "getPermission", []);
+ exec(win, fail, 'Geolocation', 'getPermission', []);
},
- watchPosition: function(success, error, args) {
+ watchPosition: function (success, error, args) {
var pluginWatchId = utils.createUUID();
- var win = function() {
- var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation');
+ var win = function () {
+ var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation'); // eslint-disable-line no-undef
pluginToNativeWatchMap[pluginWatchId] = geo.watchPosition(success, error, args);
};
- var fail = function() {
+ var fail = function () {
if (error) {
error(new PositionError(PositionError.PERMISSION_DENIED, 'Illegal Access'));
}
};
- exec(win, fail, "Geolocation", "getPermission", []);
+ exec(win, fail, 'Geolocation', 'getPermission', []);
return pluginWatchId;
},
- clearWatch: function(pluginWatchId) {
- var win = function() {
+ clearWatch: function (pluginWatchId) {
+ var win = function () {
var nativeWatchId = pluginToNativeWatchMap[pluginWatchId];
- var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation');
+ var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation'); // eslint-disable-line no-undef
geo.clearWatch(nativeWatchId);
};
- exec(win, null, "Geolocation", "getPermission", []);
+ exec(win, null, 'Geolocation', 'getPermission', []);
}
};
diff --git a/StoneIsland/plugins/cordova-plugin-geolocation/www/blackberry10/GeolocationProxy.js b/StoneIsland/plugins/cordova-plugin-geolocation/www/blackberry10/GeolocationProxy.js
deleted file mode 100644
index 0bba2263..00000000
--- a/StoneIsland/plugins/cordova-plugin-geolocation/www/blackberry10/GeolocationProxy.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var idsMap = {},
- geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation');
-
-module.exports = {
-
- getLocation: function(success, error, args) {
- 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]
- });
- },
-
- addWatch: function(success, error, args) {
- 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 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);
diff --git a/StoneIsland/plugins/cordova-plugin-geolocation/www/geolocation.js b/StoneIsland/plugins/cordova-plugin-geolocation/www/geolocation.js
index f1f64456..c6c57884 100644
--- a/StoneIsland/plugins/cordova-plugin-geolocation/www/geolocation.js
+++ b/StoneIsland/plugins/cordova-plugin-geolocation/www/geolocation.js
@@ -19,16 +19,16 @@
*
*/
-var argscheck = require('cordova/argscheck'),
- utils = require('cordova/utils'),
- exec = require('cordova/exec'),
- PositionError = require('./PositionError'),
- Position = require('./Position');
+var argscheck = require('cordova/argscheck');
+var utils = require('cordova/utils');
+var exec = require('cordova/exec');
+var PositionError = require('./PositionError');
+var Position = require('./Position');
-var timers = {}; // list of timers in use
+var timers = {}; // list of timers in use
// Returns default params, overrides if provided with values
-function parseParameters(options) {
+function parseParameters (options) {
var opt = {
maximumAge: 0,
enableHighAccuracy: false,
@@ -55,20 +55,20 @@ function parseParameters(options) {
}
// Returns a timeout failure, closed over a specified timeout value and error callback.
-function createTimeout(errorCallback, timeout) {
- var t = setTimeout(function() {
+function createTimeout (errorCallback, timeout) {
+ var t = setTimeout(function () {
clearTimeout(t);
t = null;
errorCallback({
- code:PositionError.TIMEOUT,
- message:"Position retrieval timed out."
+ code: PositionError.TIMEOUT,
+ message: 'Position retrieval timed out.'
});
}, timeout);
return t;
}
var geolocation = {
- lastPosition:null, // reference to last known (cached) position returned
+ lastPosition: null, // reference to last known (cached) position returned
/**
* Asynchronously acquires the current position.
*
@@ -76,15 +76,15 @@ var geolocation = {
* @param {Function} errorCallback The function to call when there is an error getting the heading position. (OPTIONAL)
* @param {PositionOptions} options The options for getting the position data. (OPTIONAL)
*/
- getCurrentPosition:function(successCallback, errorCallback, options) {
+ getCurrentPosition: function (successCallback, errorCallback, options) {
argscheck.checkArgs('fFO', 'geolocation.getCurrentPosition', arguments);
options = parseParameters(options);
// Timer var that will fire an error callback if no position is retrieved from native
// before the "timeout" param provided expires
- var timeoutTimer = {timer:null};
+ var timeoutTimer = {timer: null};
- var win = function(p) {
+ var win = function (p) {
clearTimeout(timeoutTimer.timer);
if (!(timeoutTimer.timer)) {
// Timeout already happened, or native fired error callback for
@@ -94,20 +94,20 @@ var geolocation = {
}
var pos = new Position(
{
- latitude:p.latitude,
- longitude:p.longitude,
- altitude:p.altitude,
- accuracy:p.accuracy,
- heading:p.heading,
- velocity:p.velocity,
- altitudeAccuracy:p.altitudeAccuracy
+ latitude: p.latitude,
+ longitude: p.longitude,
+ altitude: p.altitude,
+ accuracy: p.accuracy,
+ heading: p.heading,
+ velocity: p.velocity,
+ altitudeAccuracy: p.altitudeAccuracy
},
p.timestamp
);
geolocation.lastPosition = pos;
successCallback(pos);
};
- var fail = function(e) {
+ var fail = function (e) {
clearTimeout(timeoutTimer.timer);
timeoutTimer.timer = null;
var err = new PositionError(e.code, e.message);
@@ -123,8 +123,8 @@ var geolocation = {
// If the cached position check failed and the timeout was set to 0, error out with a TIMEOUT error object.
} else if (options.timeout === 0) {
fail({
- code:PositionError.TIMEOUT,
- message:"timeout value in PositionOptions set to 0 and no cached Position object available, or cached Position object's age exceeds provided PositionOptions' maximumAge parameter."
+ code: PositionError.TIMEOUT,
+ message: "timeout value in PositionOptions set to 0 and no cached Position object available, or cached Position object's age exceeds provided PositionOptions' maximumAge parameter."
});
// Otherwise we have to call into native to retrieve a position.
} else {
@@ -139,7 +139,7 @@ var geolocation = {
// always truthy before we call into native
timeoutTimer.timer = true;
}
- exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.maximumAge]);
+ exec(win, fail, 'Geolocation', 'getLocation', [options.enableHighAccuracy, options.maximumAge]);
}
return timeoutTimer;
},
@@ -152,7 +152,7 @@ var geolocation = {
* @param {PositionOptions} options The options for getting the location data such as frequency. (OPTIONAL)
* @return String The watch id that must be passed to #clearWatch to stop watching.
*/
- watchPosition:function(successCallback, errorCallback, options) {
+ watchPosition: function (successCallback, errorCallback, options) {
argscheck.checkArgs('fFO', 'geolocation.getCurrentPosition', arguments);
options = parseParameters(options);
@@ -161,7 +161,7 @@ var geolocation = {
// Tell device to get a position ASAP, and also retrieve a reference to the timeout timer generated in getCurrentPosition
timers[id] = geolocation.getCurrentPosition(successCallback, errorCallback, options);
- var fail = function(e) {
+ var fail = function (e) {
clearTimeout(timers[id].timer);
var err = new PositionError(e.code, e.message);
if (errorCallback) {
@@ -169,20 +169,20 @@ var geolocation = {
}
};
- var win = function(p) {
+ var win = function (p) {
clearTimeout(timers[id].timer);
if (options.timeout !== Infinity) {
timers[id].timer = createTimeout(fail, options.timeout);
}
var pos = new Position(
{
- latitude:p.latitude,
- longitude:p.longitude,
- altitude:p.altitude,
- accuracy:p.accuracy,
- heading:p.heading,
- velocity:p.velocity,
- altitudeAccuracy:p.altitudeAccuracy
+ latitude: p.latitude,
+ longitude: p.longitude,
+ altitude: p.altitude,
+ accuracy: p.accuracy,
+ heading: p.heading,
+ velocity: p.velocity,
+ altitudeAccuracy: p.altitudeAccuracy
},
p.timestamp
);
@@ -190,7 +190,7 @@ var geolocation = {
successCallback(pos);
};
- exec(win, fail, "Geolocation", "addWatch", [id, options.enableHighAccuracy]);
+ exec(win, fail, 'Geolocation', 'addWatch', [id, options.enableHighAccuracy]);
return id;
},
@@ -199,11 +199,11 @@ var geolocation = {
*
* @param {String} id The ID of the watch returned from #watchPosition
*/
- clearWatch:function(id) {
+ clearWatch: function (id) {
if (id && timers[id] !== undefined) {
clearTimeout(timers[id].timer);
timers[id].timer = false;
- exec(null, null, "Geolocation", "clearWatch", [id]);
+ exec(null, null, 'Geolocation', 'clearWatch', [id]);
}
}
};