Package Exports
- google-maps
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (google-maps) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
google-maps-loader
Async loader for google maps api.
Version >= 4.0.0: Typescript definitions are published with this package. Install @types/google-maps
for previous
versions.
This module does not change original google maps api in any way. It just provide easy way to load and use this API asynchronously.
Browser only!
Installation
$ npm install --save google-maps
Usage
import {Loader, LoaderOptions} from 'google-maps';
// or const {Loader} = require('google-maps'); without typescript
const options: LoaderOptions = {/* todo */};
const loader = new Loader('my-api-key', options);
const google = await loader.load();
const map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8,
});
Without await/async:
loader.load().then(function (google) {
const map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8,
});
});
Options
version
: https://developers.google.com/maps/documentation/javascript/versionsclient
: https://developers.google.com/maps/documentation/javascript/get-api-key#client-idchannel
: https://developers.google.com/maps/premium/reports/usage-reports#channelslanguage
: https://developers.google.com/maps/documentation/javascript/localizationregion
: https://developers.google.com/maps/documentation/javascript/localization#Regionlibraries
: https://developers.google.com/maps/documentation/javascript/libraries
Changelog list
4.2.3
- Add support for IE11 #78
4.2.2
- Allow authorization using
clientID
#77
- Allow authorization using
4.2.0
- Add official types from @types/googlemaps
4.1.1
- Rebuild package
4.1.0
- Reject on load error
- Reject on authentication error
4.0.0
- Rewrite in typescript with await/async support
3.2.1
- Typo in readme
3.2.0
3.1.0
3.0.0
- Register to bower registry
- Moved to Carrooi organization
- Using mocked loader, so tests are much faster
- Optimized building request url
- Some variables and methods are now private and not accessible from outside
- Updated dependencies
- Whole package is written in javascript, not coffeescript
2.1.1
- Sh**.... Forgot to increase version at package.json
2.1.0
2.0.0
- Added Maps API for Business support
- Added standalone version for non common js environments
- Removed dependency on q package
- Using callback instead of promise
- Added tests + travis
- Added status badges
1.0.0
- Initial version