From d7ce09058294dd080643c9c0bd82527a062e6b8a Mon Sep 17 00:00:00 2001 From: PanayotCankov Date: Fri, 23 May 2014 09:36:14 +0300 Subject: [PATCH] Set "external ambient module declaration" for "location". --- Tests/location-tests.ts | 3 +- location/location.d.ts | 213 ++++++++++++++++++++-------------------- 2 files changed, 109 insertions(+), 107 deletions(-) diff --git a/Tests/location-tests.ts b/Tests/location-tests.ts index bfb6c8dee..be0eaf4e1 100644 --- a/Tests/location-tests.ts +++ b/Tests/location-tests.ts @@ -7,8 +7,7 @@ // 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; diff --git a/location/location.d.ts b/location/location.d.ts index c209bcf50..398a58d1b 100644 --- a/location/location.d.ts +++ b/location/location.d.ts @@ -1,119 +1,122 @@ -import promises = require("promises"); + +declare module "location" { + import promises = require("promises"); -export declare enum Accuracy { - // in meters - ANY, - HIGH, -} + 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 { - latitude: number; - longitude: number; + class Location { + latitude: number; + longitude: number; - altitude: number; // in meters + altitude: number; // in meters - horizontalAccuracy: number; // in meters - verticalAccuracy: number; // in meters + horizontalAccuracy: number; // in meters + verticalAccuracy: number; // in meters - speed: number; // in m/s + speed: number; // in m/s - direction: number; // in degrees + direction: number; // in degrees - timestamp: Date; + timestamp: Date; - public android: any; // android Location - public ios: any; // iOS CLLocation -} + public android: any; // android Location + public ios: any; // iOS CLLocation + } -export interface Options { - /** - * Specifies desired accuracy in meters. Defaults to DesiredAccuracy.HIGH - */ - desiredAccuracy?: number; + export interface Options { + /** + * Specifies desired accuracy in meters. Defaults to DesiredAccuracy.HIGH + */ + desiredAccuracy?: number; + + /** + * Update distance filter in meters. Specifies how often to update. Default on iOS is no filter, on Android it is 0 meters + */ + updateDistance?: number; + + /** + * Minimum time interval between location updates, in milliseconds (ignored on iOS) + */ + minimumUpdateTime?: number; + + /** + * how old locations to receive in ms. + */ + maximumAge?: number; + + /** + * how long to wait for a location in ms. + */ + timeout?: number; + } + + class LocationManager { + /** + * Report are location services switched ON for this device (on Android) or application (iOS) + */ + static isEnabled(): boolean; + + /** + * Measure distance in meters between two locations + */ + static distance(loc1: Location, loc2: Location): number; + + /** + * Specifies desired accuracy in meters. Defaults to DesiredAccuracy.HIGH + */ + desiredAccuracy: number; + + /** + * Update distance filter in meters. Specifies how often to update. Default on iOS is no filter, on Android it is 0 meters + */ + updateDistance: number; + + /** + * Minimum time interval between location updates, in milliseconds (ignored on iOS) + */ + minimumUpdateTime: number; + + /** + * True if location listener is already started. In this case all other start requests will be ignored + */ + isStarted: boolean; + + // monitoring + + /** + * Starts location monitoring. + */ + startLocationMonitoring(onLocation: (location: Location) => any, onError?: (error: Error) => any, options?: Options); + + /** + * Stops location monitoring + */ + stopLocationMonitoring(); + + // other + + /** + * Returns last known location from device's location services or null of no known last location + */ + lastKnownLocation: Location; + } /** - * Update distance filter in meters. Specifies how often to update. Default on iOS is no filter, on Android it is 0 meters + * 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 */ - updateDistance?: number; - - /** - * Minimum time interval between location updates, in milliseconds (ignored on iOS) - */ - minimumUpdateTime?: number; - - /** - * how old locations to receive in ms. - */ - maximumAge?: number; - - /** - * how long to wait for a location in ms. - */ - timeout?: number; -} - -export declare class LocationManager { - /** - * Report are location services switched ON for this device (on Android) or application (iOS) - */ - static isEnabled(): boolean; - - /** - * Measure distance in meters between two locations - */ - static distance(loc1: Location, loc2: Location): number; - - /** - * Specifies desired accuracy in meters. Defaults to DesiredAccuracy.HIGH - */ - desiredAccuracy: number; - - /** - * Update distance filter in meters. Specifies how often to update. Default on iOS is no filter, on Android it is 0 meters - */ - updateDistance: number; - - /** - * Minimum time interval between location updates, in milliseconds (ignored on iOS) - */ - minimumUpdateTime: number; - - /** - * True if location listener is already started. In this case all other start requests will be ignored - */ - isStarted: boolean; - - // monitoring - - /** - * Starts location monitoring. - */ - startLocationMonitoring(onLocation: (location: Location) => any, onError?: (error: Error) => any, options?: Options); - - /** - * Stops location monitoring - */ - stopLocationMonitoring(); - - // other - - /** - * 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; + var getLocation: (options?: Options) => promises.Promise; +} \ No newline at end of file