11/*
2- azure-maps-geolocation-control Version: 0 .0.4
2+ azure-maps-geolocation-control Version: 1 .0.0
33
44MIT License
55
@@ -300,7 +300,14 @@ MIT License
300300 map . setCamera ( opt ) ;
301301 }
302302 }
303- self . _invokeEvent ( 'geolocationsuccess' , lastKnownPosition ) ;
303+ var args = {
304+ type : 'geolocationsuccess' ,
305+ feature : lastKnownPosition ,
306+ } ;
307+ if ( ! isNaN ( self . _lastCompassHeading ) ) {
308+ args . compassHeading = self . _lastCompassHeading ;
309+ }
310+ self . _invokeEvent ( 'geolocationsuccess' , args ) ;
304311 }
305312 } ;
306313 /**
@@ -309,7 +316,10 @@ MIT License
309316 */
310317 _this . _onGpsError = function ( error ) {
311318 //Don't do anything other than report the error. Often it will be that there was a timeout when getting the users location.
312- _this . _invokeEvent ( 'geolocationerror' , error ) ;
319+ _this . _invokeEvent ( 'geolocationerror' , {
320+ type : 'geolocationerror' ,
321+ error : error
322+ } ) ;
313323 } ;
314324 /**
315325 * An event handler for when the device orientation changes. This is used to update the compass heading.
@@ -347,7 +357,14 @@ MIT License
347357 self . _compassEventUpdateScheduled = true ;
348358 //Throttle.
349359 setTimeout ( function ( ) {
350- self . _invokeEvent ( 'compassheadingchanged' , h_1 ) ;
360+ var args = {
361+ type : 'compassheadingchanged' ,
362+ compassHeading : h_1
363+ } ;
364+ if ( self . _lastKnownPosition ) {
365+ args . feature = self . _lastKnownPosition ;
366+ }
367+ self . _invokeEvent ( 'compassheadingchanged' , args ) ;
351368 self . _compassEventUpdateScheduled = false ;
352369 } , self . _options . compassEventThrottleDelay ) ;
353370 }
@@ -472,11 +489,14 @@ MIT License
472489 //Device doesn't support getting position.
473490 //@ts -ignore
474491 self . _invokeEvent ( 'geolocationerror' , {
475- code : 2 ,
476- message : 'Geolocation API not supported by device.' ,
477- PERMISSION_DENIED : 1 ,
478- POSITION_UNAVAILABLE : 2 ,
479- TIMEOUT : 3
492+ type : 'geolocationerror' ,
493+ error : {
494+ code : 2 ,
495+ message : 'Geolocation API not supported by device.' ,
496+ PERMISSION_DENIED : 1 ,
497+ POSITION_UNAVAILABLE : 2 ,
498+ TIMEOUT : 3
499+ }
480500 } ) ;
481501 }
482502 } ) ;
0 commit comments