Skip to content

Commit

Permalink
Merge pull request #103 from G-Rath/add-promise-constructor-example
Browse files Browse the repository at this point in the history
Added example of promise constructor
  • Loading branch information
stephenmcd authored Jul 11, 2017
2 parents 8e3d28f + 8697305 commit af35a0a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/HOME.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ NOTE: Promises are only available if you supply a
constructor to the [`createClient()`](module-@google_maps.html#.createClient) method. You must also chain `.asPromise()` to a method before any `.then()` or `.catch()` methods.
For example:
```js
// Create client with a Promise constructor
const googleMapsClient = require('@google/maps').createClient({
key: 'your API key here',
Promise: Promise // 'Promise' is the native constructor.
});

// Geocode an address with a promise
googleMapsClient.geocode({address: '1600 Amphitheatre Parkway, Mountain View, CA'}).asPromise()
.then((response) => {
Expand Down

0 comments on commit af35a0a

Please sign in to comment.