gmapsloader
v0.1.1
Published
The easiest way to handle Google Map API loading
Downloads
9
Readme
Gmaps Loader
The easiest way to handle Google Map API loading
Installation
$ npm install gmapsloader
Set-up Google API Key
GMapsLoader.setApiKey('Ab1Cd2Ef3Gh4Ij5Kl6Mn7Op8Qr9St0Uv1Wx2Yz3')
Enqueue your callbacks
GMapsLoader.enqueue(function() {
// do stuffs
})
You can also enqueue callbacks with dependencies
GMapsLoader.enqueue(function() {
// do stuffs with geometry library
}, ['geometry'])
Load Google Maps API
GMapsLoader.load() // this will load the core
GMapsLoader.load('geometry', 'places') // this will also load libraries geometry and places
All the enqueued callbacks will be fired after the Google Maps API is loaded. If you enqueue a callback after the Google Maps API is loaded, it will run immediately.