Last active
November 7, 2015 18:32
-
-
Save bunnyhawk/126fb1508e71088f1be1 to your computer and use it in GitHub Desktop.
An async Google Map module example
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
// Google Script on page: | |
// <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=googleMap.init" | |
// async defer></script> | |
var googleMap = (function(){ | |
var myLatLng = {lat: 47.550987, lng: -122.277863}, | |
map, | |
marker; | |
function initMap() { | |
map = new google.maps.Map(document.getElementById('map'), { | |
center: myLatLng, | |
zoom: 13 | |
}); | |
marker = new google.maps.Marker({ | |
position: myLatLng, | |
map: map | |
}); | |
} | |
return { | |
init: function() { | |
return initMap(); | |
} | |
}; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment