Set "external ambient module declaration" for "location".

This commit is contained in:
PanayotCankov
2014-05-23 09:36:14 +03:00
parent a53cd14176
commit d7ce090582
2 changed files with 109 additions and 107 deletions

View File

@@ -7,8 +7,7 @@
// </snippet>
import TKUnit = require("Tests/TKUnit");
import locationModule = require("location/location");
import types = require("location/location-types");
import locationModule = require("location");
var LocationManager = locationModule.LocationManager;
var Location = locationModule.Location;

View File

@@ -1,20 +1,22 @@
import promises = require("promises");

declare module "location" {
import promises = require("promises");
export declare enum Accuracy {
enum Accuracy {
// in meters
ANY,
HIGH,
}
}
// For future usage
//export declare class LocationRegion {
// public latitude: number;
// public longitude: number;
// For future usage
//class LocationRegion {
// public latitude: number;
// public longitude: number;
// public raduis: number; // radius in meters
//}
// public raduis: number; // radius in meters
//}
export declare class Location {
class Location {
latitude: number;
longitude: number;
@@ -31,9 +33,9 @@ export declare class Location {
public android: any; // android Location
public ios: any; // iOS CLLocation
}
}
export interface Options {
export interface Options {
/**
* 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.
*/
timeout?: number;
}
}
export declare class LocationManager {
class LocationManager {
/**
* 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
*/
lastKnownLocation: Location;
}
}
/**
* 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
* location received is older it won't be received
*/
export declare var getLocation: (options?: Options) => promises.Promise<Location>;
/**
* 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
* location received is older it won't be received
*/
var getLocation: (options?: Options) => promises.Promise<Location>;
}