mpetazzoni / leaflet-gpx

A GPX track plugin for Leaflet.js
http://mpetazzoni.github.io/leaflet-gpx
BSD 2-Clause "Simplified" License
545 stars 118 forks source link

reload() error? #76

Closed copilador closed 4 years ago

copilador commented 5 years ago

Hi. The function gpx.reload() in setInterval "(setInterval(function() { gpx.reload();}, 3000); " only works the first cycle, then runs continuously, is an error in my code? Thank you

niyasrahman commented 4 years ago

Try This


let gpxLayer = new L.GPX(gpx, { async: true }).on('loaded', function (e) {
      map.fitBounds(e.target.getBounds());
  }).addTo(map);
 setInterval(function () {
            gpxLayer.reload();
  }, 5000);