ArcGIS JS API 4.32 uses the <arcgis-map> HTML style with Web Component for the esri/widgets/BasemapGallery component. I have hundreds of pages with the classic way to setup a mapView with the classic way to initialise widgets to the webView. How can I replace the classic Widget initialisation for the new Web Component in my existing projects?
This is the way I initialised all my projects:
webMap = new WebMap({
portalItem: {
id: <mymapid>,
portal: <myarcgisportal>
}
});
view = new MapView({
container: "mapDiv",
map: webMap,
});
var basemapGallery;
var basemapele = document.createElement('div');
basemapele.setAttribute('data-toggle', 'Tooltip');
basemapele.setAttribute('title', 'Basis kaarten');
basemapele.className = "esri-icon-basemap esri-widget--button esri-widget esri-interactive home";
basemapele.addEventListener('click', function(evt){
if (basemapGallery) {
basemapGallery.destroy();
basemapGallery = null;
}
else {
basemapGallery = new BasemapGallery({
view: view
});
view.ui.add(basemapGallery,"top-right");
}
})
view.ui.add(basemapele, "top-left");
I have the token mechanism in Javascript, to be able to work with private maps, so if you have a solution to work 'the other way around", meaning I change my HTML to the new style:
<arcgis-map item-id="123456789123456789" id="mapDiv">
<arcgis-basemap-gallery></arcgis-basemap-gallery>
</arcgis-map>
How can I apply the Token to this setup, so I can work with private maps? In the classic way I assign the token with:
esriId.registerToken({
server: <argisserver>,
token: <mytoken>
});
It didn't find esriId in the 4.32 documentation, and I have no clue how to combine the new and old initialisations. Thanks in advance!