Skip to content

Commit

Permalink
Add ability to use beta renderer (#14)
Browse files Browse the repository at this point in the history
* add ability to use beta renderer (see https://developers.google.com/maps/documentation/javascript/beta-renderer)

* adding yarn.lock back in - oops!
  • Loading branch information
Liam Potter authored and Akryum committed May 20, 2018
1 parent cace712 commit bef4587
Show file tree
Hide file tree
Showing 2 changed files with 4,136 additions and 4,133 deletions.
9 changes: 6 additions & 3 deletions src/lib-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const loader = {
* @param loadCn Boolean. If set to true, the map will be loaded form goole maps China
* (@see https://developers.google.com/maps/documentation/javascript/basics#GoogleMapsChina)
*/
load ({ apiKey, version, libraries, loadCn }) {
load ({ apiKey, version, libraries, loadCn, useBetaRenderer }) {
if (typeof window === 'undefined') {
// Do nothing if run from server-side
return Promise.resolve()
Expand Down Expand Up @@ -58,8 +58,11 @@ const loader = {
.map((key) => encodeURIComponent(key) + '=' + encodeURIComponent(options[key]))
.join('&')

if (version) {
url = url + '&v=' + version
const usingBetaRenderer = (version && version === '3.exp') ||
(typeof useBetaRenderer === 'boolean' && useBetaRenderer === true)

if (usingBetaRenderer || version) {
url = url + '&v=' + (usingBetaRenderer ? '3.exp&slippy=true' : version)
}

googleMapScript.setAttribute('src', url)
Expand Down
Loading

0 comments on commit bef4587

Please sign in to comment.