Is there any way to determine if a feature layer can be accessed by the map before adding it?
In cases where a layer is a protected resource, I don't want it sitting in the layerlist with a warning that it is not accessable.
close @Christer , no need for whenOnce().
It ended up being along the lines of:
try { await layer.load(); // execute rest of code } catch (e) { // manage exception }
Hi, you can manually try load the layer before adding it to the map. if im not mistaken.
Sample:
import { whenOnce } from '@arcgis/core/core/reactiveUtils'; myLayer = new FeatureLayer(..) whenOnce(() => myLayer.loaded == true).then(() => { console.log('All good'); view.map.add(myLayer); }); myLayer.load();
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.