Experience-Monks / google-maps-api

Get up and running with the google maps API quickly
MIT License
34 stars 13 forks source link

google-maps-api

Load a Google Maps API Object asynchronously. This module will return a Promise. Which will on resolved will return the "google.maps" object.

Or if you prefer you can simply use the callback instead.

This module also includes utility modules to be able to use parts of the maps api quickly:

geocode

Example

using via promise

var mapsapi = require( 'google-maps-api' )( 'your api key' );

mapsapi().then( function( maps ) {

  //use the google.maps object as you please
});

using via callback

require( 'google-maps-api' )( 'your api key', function( maps ) {

  //use the google.maps object as you please
})

including external google maps libraries

require( 'google-maps-api' )( 'your api key', ['places'], function( maps ) {

  //the google.maps object will now have the places api (google.maps.places)
})

API

Returns: Promise - When this promise resolves it will return the google.maps object