mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Set "external ambient module declaration" for "location".
This commit is contained in:
@@ -7,8 +7,7 @@
|
|||||||
// </snippet>
|
// </snippet>
|
||||||
|
|
||||||
import TKUnit = require("Tests/TKUnit");
|
import TKUnit = require("Tests/TKUnit");
|
||||||
import locationModule = require("location/location");
|
import locationModule = require("location");
|
||||||
import types = require("location/location-types");
|
|
||||||
|
|
||||||
var LocationManager = locationModule.LocationManager;
|
var LocationManager = locationModule.LocationManager;
|
||||||
var Location = locationModule.Location;
|
var Location = locationModule.Location;
|
||||||
|
|||||||
45
location/location.d.ts
vendored
45
location/location.d.ts
vendored
@@ -1,20 +1,22 @@
|
|||||||
import promises = require("promises");
|
|
||||||
|
declare module "location" {
|
||||||
|
import promises = require("promises");
|
||||||
|
|
||||||
export declare enum Accuracy {
|
enum Accuracy {
|
||||||
// in meters
|
// in meters
|
||||||
ANY,
|
ANY,
|
||||||
HIGH,
|
HIGH,
|
||||||
}
|
}
|
||||||
|
|
||||||
// For future usage
|
// For future usage
|
||||||
//export declare class LocationRegion {
|
//class LocationRegion {
|
||||||
// public latitude: number;
|
// public latitude: number;
|
||||||
// public longitude: number;
|
// public longitude: number;
|
||||||
|
|
||||||
// public raduis: number; // radius in meters
|
// public raduis: number; // radius in meters
|
||||||
//}
|
//}
|
||||||
|
|
||||||
export declare class Location {
|
class Location {
|
||||||
latitude: number;
|
latitude: number;
|
||||||
longitude: number;
|
longitude: number;
|
||||||
|
|
||||||
@@ -31,9 +33,9 @@ export declare class Location {
|
|||||||
|
|
||||||
public android: any; // android Location
|
public android: any; // android Location
|
||||||
public ios: any; // iOS CLLocation
|
public ios: any; // iOS CLLocation
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Options {
|
export interface Options {
|
||||||
/**
|
/**
|
||||||
* Specifies desired accuracy in meters. Defaults to DesiredAccuracy.HIGH
|
* Specifies desired accuracy in meters. Defaults to DesiredAccuracy.HIGH
|
||||||
*/
|
*/
|
||||||
@@ -58,9 +60,9 @@ export interface Options {
|
|||||||
* how long to wait for a location in ms.
|
* how long to wait for a location in ms.
|
||||||
*/
|
*/
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare class LocationManager {
|
class LocationManager {
|
||||||
/**
|
/**
|
||||||
* Report are location services switched ON for this device (on Android) or application (iOS)
|
* Report are location services switched ON for this device (on Android) or application (iOS)
|
||||||
*/
|
*/
|
||||||
@@ -109,11 +111,12 @@ export declare class LocationManager {
|
|||||||
* Returns last known location from device's location services or null of no known last location
|
* Returns last known location from device's location services or null of no known last location
|
||||||
*/
|
*/
|
||||||
lastKnownLocation: Location;
|
lastKnownLocation: Location;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires a single shot location search. If you specify timeout in options, location search will fail on timeout.
|
* Fires a single shot location search. If you specify timeout in options, location search will fail on timeout.
|
||||||
* If you specify timeout = 0 it just requests the last known location. However if you specify maximumAge and the
|
* If you specify timeout = 0 it just requests the last known location. However if you specify maximumAge and the
|
||||||
* location received is older it won't be received
|
* location received is older it won't be received
|
||||||
*/
|
*/
|
||||||
export declare var getLocation: (options?: Options) => promises.Promise<Location>;
|
var getLocation: (options?: Options) => promises.Promise<Location>;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user