Created
October 12, 2017 04:32
-
-
Save vutran0111/ffd547f94dfb5fb5e28b2b3fa5d2daa0 to your computer and use it in GitHub Desktop.
Revisions
-
vutran0111 created this gist
Oct 12, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ function initMap() { map = new google.maps.Map(document.getElementById('map'), { // center: {lat: 42.9456, lng: -122.2}, // center: { lat: 10.7663468, lng: 106.6589143 }, zoom: 14 }); infoWindow = new google.maps.InfoWindow; // Geolocation. if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { var pos = { lat: position.coords.latitude, lng: position.coords.longitude }; infoWindow.setPosition(pos); infoWindow.setContent('Location found.'); infoWindow.open(map); map.setCenter(pos); }, function() { handleLocationError(true, infoWindow, map.getCenter()); }); loadMarkers(); setInterval(function(){ console.log("loadMarkers"); loadMarkers(); }, 30000); } else { // Browser doesn't support Geolocation handleLocationError(false, infoWindow, map.getCenter()); } // loadMarkers(); // setInterval(function(){ // console.log("loadMarkers"); // loadMarkers(); // }, 30000); }