0.2.4 • Published 8 years ago
gmaps-loader v0.2.4
gmaps-loader
Promise based Google Maps API loader
Install
npm install gmaps-loader
Example usage
var Loader = require('gmaps-loader');
var init = function() {
var loader = new Loader({
apiKey: '<YOUR_API_KEY>' //Should of course be a real key, this will throw an error.
});
loader.load()
.then(function(api) {
new api.Map(document.querySelector('#canvas'), {
center: {
lat: -34.397,
lng: 150.644
},
zoom: 8
});
});
};
document.addEventListener('DOMContentLoaded', init);
API
callback
Type: string
The callback that will be called when the API has been initialized, that is window.YOUR_CALLBACK. Default is __INIT_GMAP
.
apiKey
Type: string
Your API key, provided by Google.
To-do
- Make it possible to pass in a custom API endpoint.