Created
October 13, 2017 16:47
-
-
Save ryanvade/e5b88329c04a87e0e6d11d2d4d21e82a 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
export default class MapsPlacesProvider { | |
constructor(map) { | |
this.map = map; | |
this.service = new google.maps.places.PlaceService(map); | |
} | |
function search(placesString) { | |
let request = { | |
query: placesString | |
}; | |
let self = this; | |
return new Promise((resolve, reject) => { | |
self.service.textSearch(request, (results, status) => { | |
if (status == google.maps.places.PlacesServiceStatus.OK) { | |
resolve(results[0].geometry.location); | |
} else { | |
reject(status); | |
} | |
}); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment