From 2604b2b731391c49c990ad8e2437b9171a872839 Mon Sep 17 00:00:00 2001 From: Xaver Maierhofer Date: Sun, 7 Oct 2018 16:39:07 +0200 Subject: [PATCH] [TASK] Use Promises for GeoJSON Allow ajax requests, single or list of objects --- lib/map.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/map.js b/lib/map.js index c00669e..09b3f6f 100644 --- a/lib/map.js +++ b/lib/map.js @@ -82,7 +82,11 @@ define(['map/clientlayer', 'map/labellayer', 'map/button', 'leaflet', 'map/activ if (config.geo) { [].forEach.call(config.geo, function (geo) { - L.geoJSON(geo.json, geo.option).addTo(map); + geo.json().then(function (result) { + if (result) { + L.geoJSON(result, geo.option).addTo(map); + } + }); }); }