From ee5be4c45dbc4991c2b4d1fd66b3f9463a4f4038 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Tue, 5 Jul 2022 09:15:37 -0400 Subject: [PATCH] perf: Easier map debugging Expose a global function to examine the current map object. --- src/index.js | 6 ++++++ src/map.js | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/index.js b/src/index.js index e8b9523db9..ef0f89a73c 100644 --- a/src/index.js +++ b/src/index.js @@ -108,3 +108,9 @@ if (window && !window.$) { if (window && !window.jQuery) { window.jQuery = $; } +if (window && !window.geojsMap) { + window.geojsMap = () => { + const maps = $('.geojs-map').map((idx, m) => $(m).data('data-geojs-map')); + return maps.length === 0 ? undefined : maps.length === 1 ? maps[0] : maps; + }; +} diff --git a/src/map.js b/src/map.js index 88a22dedf0..f86854c56a 100644 --- a/src/map.js +++ b/src/map.js @@ -1966,6 +1966,8 @@ var map = function (arg) { /* Report the current version on the map object. */ this._version = require('./version'); + /* Link to the main library */ + this._geo = require('./index'); /** * Draw a layer image to a canvas context. The layer's opacity and transform