@@ -16,23 +16,59 @@ declare module "location" {
1616 // public raduis: number; // radius in meters
1717 //}
1818
19+ /**
20+ * A data class that encapsulates common properties for a geolocation.
21+ */
1922 class Location {
23+ /**
24+ * The latitude of the geolocation, in degrees.
25+ */
2026 latitude : number ;
27+
28+ /**
29+ * The longitude of the geolocation, in degrees.
30+ */
2131 longitude : number ;
2232
23- altitude : number ; // in meters
33+ /**
34+ * The altitude (if available), in meters above sea level.
35+ */
36+ altitude : number ;
2437
25- horizontalAccuracy : number ; // in meters
26- verticalAccuracy : number ; // in meters
38+ /**
39+ * The horizontal accuracy, in meters.
40+ */
41+ horizontalAccuracy : number ;
2742
28- speed : number ; // in m/s
43+ /**
44+ * The vertical accuracy, in meters.
45+ */
46+ verticalAccuracy : number ;
47+
48+ /**
49+ * The speed, in meters/second over ground.
50+ */
51+ speed : number ;
2952
30- direction : number ; // in degrees
53+ /**
54+ * The direction (course), in degrees.
55+ */
56+ direction : number ;
3157
58+ /**
59+ * The time at which this location was determined.
60+ */
3261 timestamp : Date ;
3362
34- public android : any ; // android Location
35- public ios : any ; // iOS CLLocation
63+ /**
64+ * The android-specific location object.
65+ */
66+ android : android . location . Location ;
67+
68+ /**
69+ * The ios-specific location object.
70+ */
71+ ios : CoreLocation . CLLocation ;
3672 }
3773
3874 export interface Options {
@@ -62,41 +98,49 @@ declare module "location" {
6298 timeout ?: number ;
6399 }
64100
101+ /**
102+ * Provides methods for querying geolocation (in case available) on the target platform.
103+ */
65104 class LocationManager {
66105 /**
67- * Report are location services switched ON for this device (on Android) or application (iOS)
106+ * Checks whether the location services are switched ON for this device (on Android) or application (iOS).
68107 */
69108 static isEnabled ( ) : boolean ;
70109
71110 /**
72- * Measure distance in meters between two locations
111+ * Measures the distance in meters between two locations.
112+ * @param loc1 The first location.
113+ * @param loc2 The second location.
73114 */
74115 static distance ( loc1 : Location , loc2 : Location ) : number ;
75116
76117 /**
77- * Specifies desired accuracy in meters. Defaults to DesiredAccuracy.HIGH
118+ * The desired accuracy in meters. Defaults to DesiredAccuracy.HIGH
78119 */
79120 desiredAccuracy : number ;
80121
81122 /**
82- * Update distance filter in meters. Specifies how often to update. Default on iOS is no filter, on Android it is 0 meters
123+ * The update distance filter in meters. Specifies how often to update. Default on iOS is no filter, on Android it is 0 meters.
83124 */
84125 updateDistance : number ;
85126
86127 /**
87- * Minimum time interval between location updates, in milliseconds (ignored on iOS)
128+ * The minimum time interval between subsequent location updates, in milliseconds (ignored on iOS).
88129 */
89130 minimumUpdateTime : number ;
90131
91132 /**
92- * True if location listener is already started. In this case all other start requests will be ignored
133+ * True if the location listener is already started. In this case all other start requests will be ignored.
93134 */
94135 isStarted : boolean ;
95136
96137 // monitoring
97138
98139 /**
99- * Starts location monitoring.
140+ * Starts location monitoring.
141+ * @param onLocation A function that will be called upon every location update received.
142+ * @param onError An optional error callback.
143+ * @param options An optional object specifying location update settings.
100144 */
101145 startLocationMonitoring ( onLocation : ( location : Location ) => any , onError ?: ( error : Error ) => any , options ?: Options ) ;
102146
@@ -115,8 +159,9 @@ declare module "location" {
115159
116160 /**
117161 * Fires a single shot location search. If you specify timeout in options, location search will fail on timeout.
118- * If you specify timeout = 0 it just requests the last known location. However if you specify maximumAge and the
119- * location received is older it won't be received
162+ * If you specify timeout = 0 it just requests the last known location.
163+ * However if you specify maximumAge and the location received is older it won't be received.
164+ * @param options An optional object specifying location update settings.
120165 */
121166 var getLocation : ( options ?: Options ) => promises . Promise < Location > ;
122167}
0 commit comments