Select to view content in your preferred language

Delay in getting layers image on the map

234
1
01-01-2025 09:09 PM
SaurabhDudhe
Emerging Contributor

I am using the JavaScript API to check if the  view is created for all the layers and based on it I am showing a spinner in my application to indicate the end user that the layer loading is in progress and once the layer are loaded the spinner is stopped.

I am using the whenLayerView method but the internal API which renders the layers image takes time and 
I do not have any control to show the application loading state.
Please suggest which method I can use here to have access to an event for displaying a loading state in the browser until the layers image is fetched.

Version - 4.26.0
Reference - https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView

Image API - /MapServer/export?bbox=-13672105.657400718%2C7676081.658810125%2C-12602598.757634586%2C7...

0 Kudos
1 Reply
JoelBennett
MVP Regular Contributor

I would recommend watching the updating property on the View.  For example:

view.watch("updating", function(newValue, oldValue, propertyName, target) {
	activityIndicator.style.display = ((newValue) ? "inline" : "none");
});
0 Kudos