maps: abort running geojson retrieval before starting a new one (#22605)

This commit is contained in:
Frédéric Péters 2018-03-18 22:15:06 +01:00
parent d8b17a57d9
commit 5b85c4ccb0
1 changed files with 5 additions and 1 deletions

View File

@ -8,7 +8,11 @@ $(function() {
var geojson_url = $map_widget.data('geojson-url');
if (!geojson_url) return;
$.getJSON(geojson_url, function(data) {
if (map.geojson_retrieval) {
map.geojson_retrieval.abort();
}
map.geojson_retrieval = $.getJSON(geojson_url, function(data) {
var geo_json = L.geoJson(data, {
onEachFeature: function(feature, layer) {
$(cell).trigger('combo:map-feature-prepare', {'feature': feature, 'layer': layer});