Created
March 29, 2021 07:46
-
-
Save salmanyaqoob/8cb68fa5e926edc3f23801111fa3a8df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| initLocationCompass(){ | |
| var _this = this; | |
| this.locationLoading().then(result => { | |
| console.info("Location: " + result); | |
| _this.loadCompass(result); | |
| _this.isLocationLoading = false; | |
| _this.isLocationError = false; | |
| }, error => { | |
| console.info("Location: error ->" + error); | |
| _this.isLocationLoading = false; | |
| _this.isLocationError = true; | |
| }); | |
| }, | |
| locationLoading() { | |
| return new Promise(function (resolve, reject) { | |
| return geolocation.getLocation({ | |
| success: function (data) { | |
| console.log('success get location data. latitude:' + data.latitude + 'long:' + data.longitude); | |
| return resolve({ | |
| latitude: data.latitude, | |
| longitude: data.longitude | |
| }); | |
| }, | |
| fail: function (data, code) { | |
| console.log('fail to get location. code:' + code + ', data:' + data); | |
| return reject({ | |
| error: 'fail to get location. code:' + code + ', data:' + data | |
| }); | |
| }, | |
| }); | |
| }); | |
| }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment