Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs on proper usage of asPromise() #90

Merged
merged 2 commits into from
May 29, 2017
Merged

Update docs on proper usage of asPromise() #90

merged 2 commits into from
May 29, 2017

Conversation

DaddyWarbucks
Copy link
Contributor

@DaddyWarbucks DaddyWarbucks commented May 9, 2017

In reference to #89

I left the syntax in the example for promises very simple. The asPromise() could arguably be on the next line, like the following:

googleMapsClient.geocode({address: '1600 Amphitheatre Parkway, Mountain View, CA'})
  .asPromise()
  .then((response) => {
    console.log(response.json.results);
  })
  .catch((err) => {
    console.log(err);
  });

But, I wanted people to see that it is chained onto the googleMapsClient directly and thought the code in the actual PR was more clear.

I also noticed that the second code example in the docs does not have the js declaration within the markdown to highlight it is javascript. "```js" would syntax highlight the following

// Geocode an address.
googleMapsClient.geocode({
  address: '1600 Amphitheatre Parkway, Mountain View, CA'
}, function(err, response) {
  if (!err) {
    console.log(response.json.results);
  }
});

I wasn't sure if that was done on purpose, but I would be happy to fix that as well.

  • Beau

@stephenmcd
Copy link
Contributor

I wasn't sure if that was done on purpose, but I would be happy to fix that as well.

I think it was accidentally omitted, please go for it.

@stephenmcd
Copy link
Contributor

Thanks a lot!

@stephenmcd stephenmcd merged commit 3d34778 into googlemaps:master May 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants