Skip to content

Instantly share code, notes, and snippets.

@ryanvade
Created October 13, 2017 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanvade/e5b88329c04a87e0e6d11d2d4d21e82a to your computer and use it in GitHub Desktop.
Save ryanvade/e5b88329c04a87e0e6d11d2d4d21e82a to your computer and use it in GitHub Desktop.
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