Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
HEREPlaces.prototype.getPlaces = function(query, onSuccessCallback) {
var onSuccess,
onError;
onSuccess = function(data) {
if (data.results && data.results.items) {
var places = data.results.items.map(function(place) {
place.coordinates = { lat: place.position[0], lng: place.position[1] };
return place;
});
onSuccessCallback(data.results.items);
} else {
onError(data);
}
};
onError = function(error) {
console.error('Error happened when fetching places!', error);
};
this.placeSearch.request(query, {}, onSuccess, onError);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.