import { Geolocation } from '@ionic-native/geolocation' ; import { Observable } from 'rxjs/Observable' ; import { Observer } from 'rxjs/Observer' ; export interface Coordinates { /**
     * a double representing the position's latitude in decimal degrees.
     */ latitude : number ; /**
     * A double representing the position's longitude in decimal degrees.
     */ longitude : number ; /**
     * A double representing the accuracy of the latitude and longitude properties,
     * expressed in meters.
     */ accuracy : number ; /**
     * A double representing the position's altitude in metres, relative to sea
     * level. This value can be null if the implementation cannot provide the data.
     */ altitude : number ; /**
     * A double representing the accuracy of the altitude expressed in meters.
     * This value can be null.
     */ altitudeAccuracy : number ; /**
     * A double representing the direction in which the device is traveling. This
     * value, specified in degrees, indicates how far off from heading true north
     * the device is. 0 degrees represents true north, and the direction is
     * determined clockwise (which means that east is 90 degrees and west is 270
     * degrees). If speed is 0, heading is NaN. If the device is unable to provide
     * heading information, this value is null.
     */ heading : number ; /**
     * A double representing the velocity of the device in meters per second.
     * This value can be null.
     */ speed : number ; } export interface Geoposition { /**
     * A Coordinates object defining the current location
     */ coords : Coordinates ; /**
     * A timestamp representing the time at which the location was retrieved.
     */ timestamp : number ; } export interface PositionError { /**
     * A code that indicates the error that occurred
     */ code : number ; /**
     * A message that can describe the error that occurred
     */ message : string ; } export interface GeolocationOptions { /**
     * Is a positive long value indicating the maximum age in milliseconds of a
     * possible cached position that is acceptable to return. If set to 0, it
     * means that the device cannot use a cached position and must attempt to
     * retrieve the real current position. If set to Infinity the device must
     * return a cached position regardless of its age. Default: 0.
     */ maximumAge ? : number ; /**
     * Is a positive long value representing the maximum length of time
     * (in milliseconds) the device is allowed to take in order to return a
     * position. The default value is Infinity, meaning that getCurrentPosition()
     * won't return until the position is available.
     */ timeout ? : number ; type { boolean } enableHighAccuracy ? : boolean ; } export class GeolocationMock extends Geolocation { param { GeolocationOptions } options returns { Promise < Geoposition > } getCurrentPosition ( options ? ) { let theResult ; return new Promise ( ( resolve , reject ) => { resolve ( theResult ) ; } ) ; } ; param { GeolocationOptions } options returns { Observable < Geoposition > } watchPosition ( options ? ) { let theData ; return Observable . create ( ( observer ) => { observer . next ( theData ) ; observer . complete ( ) ; } ) ; } ; }