I'm looking to implement asynchronous functionality in my function, but I'm uncertain on the best approach:
checkLocation() {
return __awaiter(this, void 0, Promise, function* () {
while (true) {
setTimeout(function () {
this.diagnostic.isLocationEnabled().then(
(isAvailable) => {
console.log('Is available? ' + isAvailable);
if (!isAvailable) {
alert('Please turn on the location service');
}
}).catch((e) => {
console.log(e);
});
}, 5000)
}
});
}
}
An issue that has arisen is TS not recognizing the name __awaiter
. I've attempted to follow guidelines from this source