-
-
Save anonymous/710a1998c4c7afe177b99d86f0024ce0 to your computer and use it in GitHub Desktop.
Sage main javascript file with google maps from https://www.npmjs.com/package/google-maps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import external dependencies | |
import 'jquery'; | |
import 'bootstrap/dist/js/bootstrap'; | |
import GoogleMapsLoader from 'google-maps'; | |
// import local dependencies | |
import Router from './util/router'; | |
import common from './routes/Common'; | |
import home from './routes/Home'; | |
import aboutUs from './routes/About'; | |
// Use this variable to set up the common and page specific functions. If you | |
// rename this variable, you will also need to rename the namespace below. | |
const doLoadGmap = (el, options) => { | |
const newMap = new window.google.maps.Map(el, options); | |
return newMap; | |
}; | |
const mapEl = document.getElementById('map'); | |
const mapOpts = { | |
center: { lat: -34.397, lng: 150.644 }, | |
scrollwheel: false, | |
zoom: 8, | |
}; | |
GoogleMapsLoader.KEY = 'AIzaSyAdQZEV2sGV_6ILHJ0xBToBnmVKGtLo19U'; | |
GoogleMapsLoader.load(doLoadGmap(mapEl, mapOpts)); | |
const routes = { | |
// All pages | |
common, | |
// Home page | |
home, | |
// About us page, note the change from about-us to aboutUs. | |
aboutUs, | |
}; | |
// Load Events | |
document.addEventListener('DOMContentLoaded', () => new Router(routes).loadEvents()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment