nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit 4325dc50968d8bdf8c51468ce0f6ff3b66b5ae89
parent 557c6bfb5f8ec50670d6f0ec4d90621a257cf094
Author: Sergej Orlov <wladimirych@gmail.com>
Date:   Sun, 26 Mar 2017 22:27:29 +0300

[elevation profile] abort loading data when removing from map

Diffstat:
Msrc/lib/leaflet.control.elevation-profile/index.js | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lib/leaflet.control.elevation-profile/index.js b/src/lib/leaflet.control.elevation-profile/index.js @@ -299,6 +299,7 @@ const ElevationProfile = L.Class.extend({ }, removeFrom: function(map) { + this.abortLoading() if (!this._map) { return; } @@ -823,8 +824,9 @@ const ElevationProfile = L.Class.extend({ req.push(latlngs[i].lat.toFixed(6) + ' ' + latlngs[i].lng.toFixed(5)); } req = req.join('\n'); - return fetch(this.options.elevationsServer, {method: 'POST', data: req}) - .then( + const xhrPromise = fetch(this.options.elevationsServer, {method: 'POST', data: req}); + this.abortLoading = xhrPromise.abort.bind(xhrPromise); + return xhrPromise.then( function(xhr) { return parseResponse(xhr.responseText); }