Skip to content

Commit

Permalink
Added example of promise constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Jul 11, 2017
1 parent 8e3d28f commit 8697305
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 8697305

Please sign in to comment.