nativescript-geolocation
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -1,3 +0,3 @@ | ||
var defModule = require("nativescript-geolocation"); | ||
var timer = require("timer"); | ||
var location = null; | ||
var Location = (function () { | ||
@@ -12,5 +12,8 @@ function Location() { | ||
options = options || {}; | ||
if (!location) { | ||
location = require("nativescript-geolocation"); | ||
} | ||
if (options && options.timeout === 0) { | ||
return new Promise(function (resolve, reject) { | ||
var lastLocation = defModule.LocationMonitor.getLastKnownLocation(); | ||
var lastLocation = location.LocationMonitor.getLastKnownLocation(); | ||
if (lastLocation) { | ||
@@ -39,5 +42,5 @@ if (options && typeof options.maximumAge === "number") { | ||
} | ||
defModule.LocationMonitor.stopLocationMonitoring(locListenerId); | ||
location.LocationMonitor.stopLocationMonitoring(locListenerId); | ||
}; | ||
if (!defModule.isEnabled()) { | ||
if (!location.isEnabled()) { | ||
reject(new Error("Location service is disabled")); | ||
@@ -61,5 +64,5 @@ } | ||
}; | ||
var locListener = defModule.LocationMonitor.createListenerWithCallbackAndOptions(successCallback, options); | ||
var locListener = location.LocationMonitor.createListenerWithCallbackAndOptions(successCallback, options); | ||
try { | ||
defModule.LocationMonitor.startLocationMonitoring(options, locListener); | ||
location.LocationMonitor.startLocationMonitoring(options, locListener); | ||
} | ||
@@ -72,3 +75,3 @@ catch (e) { | ||
var timerId = timer.setTimeout(function () { | ||
defModule.LocationMonitor.stopLocationMonitoring(locListener.id); | ||
location.LocationMonitor.stopLocationMonitoring(locListener.id); | ||
reject(new Error("Timeout while searching for location!")); | ||
@@ -75,0 +78,0 @@ }, options.timeout || defaultGetLocationTimeout); |
var appModule = require("application"); | ||
var enums = require("ui/enums"); | ||
var trace = require("trace"); | ||
var defModule = require("nativescript-geolocation"); | ||
var common = require("./nativescript-geolocation-common"); | ||
@@ -38,3 +37,3 @@ global.moduleMerge(common, exports); | ||
function locationFromAndroidLocation(androidLocation) { | ||
var location = new defModule.Location(); | ||
var location = new common.Location(); | ||
location.latitude = androidLocation.getLatitude(); | ||
@@ -41,0 +40,0 @@ location.longitude = androidLocation.getLongitude(); |
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
__.prototype = b.prototype; | ||
d.prototype = new __(); | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var enums = require("ui/enums"); | ||
var platformModule = require("platform"); | ||
var defModule = require("nativescript-geolocation"); | ||
var common = require("./nativescript-geolocation-common"); | ||
@@ -54,3 +52,3 @@ global.moduleMerge(common, exports); | ||
function locationFromCLLocation(clLocation) { | ||
var location = new defModule.Location(); | ||
var location = new common.Location(); | ||
location.latitude = clLocation.coordinate.latitude; | ||
@@ -57,0 +55,0 @@ location.longitude = clLocation.coordinate.longitude; |
{ | ||
"name": "nativescript-geolocation", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Provides API for getting and monitoring location for NativeScript app.", | ||
@@ -5,0 +5,0 @@ "main": "nativescript-geolocation.js", |
@@ -0,0 +0,0 @@ Welcome to the `nativescript-geolocation` plugin for NativeScript framework |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
24944
12
611
1