1.0.0 • Published 8 years ago
kist-loader-maps v1.0.0
kist-loader-maps
Simple maps loader. Wrapper around basic Google Maps fetching.
Install
npm install kist-loader-maps --save
Usage
var loadMaps = require('kist-loader-maps');
loadMaps({
apiKey: 'YOUR_GOOGLE_API_KEY',
language: 'en',
libraries: 'geometry'
}).then(function ( maps ) {
var map = new maps.Map(document.getElementById('map'), {
zoom: 8,
center: new maps.LatLng(-34.397, 150.644)
});
});
API
loadMaps(options)
Returns: Promise
options
Type: Object
apiKey
Type: String
Required
version
Type: Number
Default: 3
language
Type: String
Default: 'en'
Language for Google Maps UI.
libraries
Type: String[]
List of Google Maps libraries to load.
Test
For manual tests, run npm test -- --watch
and open http://localhost:9000/ in your browser.
Browser support
Tested in IE8+ and all modern browsers.
Uses Promises so you need to apply polyfill.
License
MIT © Ivan Nikolić