Sha256: 7236940d5920e1fa4f9990068f6a5a0d1251fe5b281abc1d44aae99cbdf9e716
Contents?: true
Size: 1.11 KB
Versions: 12
Compression:
Stored size: 1.11 KB
Contents
import createMapController from "src/decidim/map/factory" $(() => { // Load the map controller factory method in the document.ready handler to // allow overriding it by any script that is loaded before the document is // ready. let $mapElements = $("[data-decidim-map]"); if ($mapElements.length < 1 && $("#map").length > 0) { throw new Error( "DEPRECATION: Please update your maps customizations or include 'decidim/map/legacy.js' for legacy support!" ); } $mapElements.each((_i, el) => { const $map = $(el); let mapId = $map.attr("id"); if (!mapId) { mapId = `map-${Math.random().toString(36).substr(2, 9)}`; $map.attr("id", mapId); } const mapConfig = $map.data("decidim-map"); const ctrl = createMapController(mapId, mapConfig); const map = ctrl.load(); $map.data("map", map); $map.data("map-controller", ctrl); $map.trigger("configure.decidim", [map, mapConfig]); ctrl.start(); // Indicates the map is loaded with the map objects initialized and ready // to be used. $map.trigger("ready.decidim", [map, mapConfig]); }); });
Version data entries
12 entries across 12 versions & 1 rubygems