Detecting the Image is loaded

320
1
03-02-2022 11:05 AM
ColeNewman
New Contributor

Hi,

I have a question regarding ImageryLayer. It can take awhile to load the Image and I want to remove the spinner when it is done updating. I found this relevant post Solved: How to tell if an Imagery Layer is drawn in the vi... - Esri Community but it doesn't seem to solve my problem. The spinner cuts off before the image is loaded on the map. Any help for ideas on how to get this to work would be appreciated thank you!

Tags (4)
0 Kudos
1 Reply
UndralBatsukh
Esri Regular Contributor

Hi there,

Please check out this sample as it shows what you are trying to achieve: https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=client-projection


The following is the code and it waits until layer's layerView.updating becomes false when the app loads first. The LayerView.updating becomes false once it finishes updating.

view.whenLayerView(countriesLayer).then((layerView) => {
  watchUtils.whenFalseOnce(layerView, "updating", () => {
    // enable the projection dropdown
    wkidSelect.disabled = false;
    calciteLoader.removeAttribute("active");
   });
 });

 

0 Kudos