Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_asyncAdd: function () {
var map = this._map;
if (map.attributionControl) {
if (this._customTileset) {
if (this._copyrightText) {
// pull static copyright text for services published with Pro
map.attributionControl.addAttribution('<span class="esri-dynamic-attribution">' + this._copyrightText + '</span>');
}
} else {
// provide dynamic attribution for Esri basemaps
Util._getAttributionData('https://static.arcgis.com/attribution/World_Street_Map', map);
map.attributionControl.addAttribution('<span class="esri-dynamic-attribution">USGS, NOAA</span>');
map.on('moveend', Util._updateMapAttribution);
}
}
// set the background color of the map to the background color of the tiles
map.getContainer().style.background = this._mapboxGL.options.style.layers[0].paint['background-color'];
this._mapboxGL.addTo(map, this);
}
});
_asyncAdd: function () {
var map = this._map;
// thought it was just me, but apparently its not easy to mixin two different styles
// https://github.com/mapbox/mapbox-gl-js/issues/4000
// set the background color of the map to the background color of the tiles
map.getContainer().style.background = this._mapboxGL.options.style.layers[0].paint['background-color'] || '#e1e3d0';
map.on('moveend', Util._updateMapAttribution);
this._mapboxGL.addTo(map, this);
// map._gl = this._mapboxGL;
}
});
onRemove: function (map) {
map.off('moveend', Util._updateMapAttribution);
map.removeLayer(this._mapboxGL);
if (map.attributionControl) {
var vectorAttribution = document.getElementsByClassName('esri-dynamic-attribution')[0].outerHTML;
// this doesn't work, not sure why.
map.attributionControl.removeAttribution(vectorAttribution);
}
},
onRemove: function (map) {
map.off('moveend', Util._updateMapAttribution);
map.removeLayer(this._mapboxGL);
if (map.attributionControl) {
var vectorAttribution = document.getElementsByClassName('esri-dynamic-attribution')[0].outerHTML;
// this doesn't work, not sure why.
map.attributionControl.removeAttribution(vectorAttribution);
}
},