Skip to content

Instantly share code, notes, and snippets.

@thanley11
Last active May 8, 2020 00:09
Show Gist options
  • Save thanley11/92c1f24f0852306926d184c816b14f77 to your computer and use it in GitHub Desktop.
Save thanley11/92c1f24f0852306926d184c816b14f77 to your computer and use it in GitHub Desktop.
async getPlaces(latLng, maxResults) {
try {
const places = await this._placeServer.getNearbyPlaces(latLng, maxResults);
const getAllImageUrls = places.map(async (p) => {
let url = await this._imageServer.getImageForPlace(p.placeName, p.latLng);
let place = this._placeServer.getPlaceAt(p.placeName, p.latLng);
return new CompletePlaceData(place._placeName, place["_latLng"]._latitude, place["_latLng"]._longitude, place._address, place._priceLevel, place._rating, url);
});
return await Promise.all(getAllImageUrls);
} catch(error){
console.error(error,'getPlaces Error');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment