Skip to content
Permalink
Browse files
Using a fallback epsilon in case Number.EPSILON is not defined.
  • Loading branch information
dblotsky committed Feb 15, 2016
1 parent a6da270 commit e8c921af320a7ca67cde2533db3125759d5e133a
Showing 1 changed file with 9 additions and 2 deletions.
@@ -18,6 +18,9 @@ var PositionError = require('./PositionError');
var callbacks = {};
var locs = {};

// constants
var FALLBACK_EPSILON = 0.001;

function ensureAndCreateLocator() {
var deferral;

@@ -162,7 +165,11 @@ module.exports = {
// JavaScript runtime error: Operation aborted
// You must set the MovementThreshold property or the ReportInterval property before adding event handlers.
// WinRT information: You must set the MovementThreshold property or the ReportInterval property before adding event handlers
loc.movementThreshold = Number.EPSILON;
if (Number.EPSILON) {
loc.movementThreshold = Number.EPSILON;
} else {
loc.movementThreshold = FALLBACK_EPSILON;
}
}

loc.addEventListener("positionchanged", onPositionChanged);
@@ -190,4 +197,4 @@ module.exports = {
}
};

require("cordova/exec/proxy").add("Geolocation", module.exports);
require("cordova/exec/proxy").add("Geolocation", module.exports);

1 comment on commit e8c921a

@daserge
Copy link
Contributor

@daserge daserge commented on e8c921a Feb 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Dmitry!

Please sign in to comment.