Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getResults(makers) {
- const chain = makers.map(latLong => getGeocodeData(latLong))
- Promise.all(chain)
- .then(results => {
- console.log('results', results)
- //AQUI VOCÊ FAZ O .MAP
- })
- .reject(error => {
- console.log('error', error)
- })
- }
- function getGeocodeData(latLong) {
- const geocoder = new google.maps.Geocoder()
- return new Promise((resolve, reject) => {
- geocoder.geocode({ 'location': latLong }, (result, status) => {
- // console.log(results, status)
- if (status !== 'OK') {
- reject()
- }
- else {
- resolve(result)
- }
- })
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement