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