How to know when a layer is actually done being applied?

409
2
Jump to solution
01-21-2020 11:26 AM
DavidKucharski
New Contributor II

I have the following code that shows a MapImageLayer. After the last line is called, document.body.style.cursor = "default"; there is a lag time of 20 seconds before the layer is actually visible on the map. 

Since the cursor is set back to default, the user is thinking the process is over and the layer should be there. I would like to set the cursor back to default when the layer is actually shown on the map. How do I get that?

function OnAppliedMarketsSuccess(response, userContext, methodName) {
   var geographies = response.toString();

   var marketLayer = appliedMarketLayer.findSublayerById(0);
   marketLayer.definitionExpression = "ID_ in (" + geographies + ")";
   marketLayer.visible = true;

   document.body.style.cursor = "default";

}

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

I've found Rene Rubalcava‌'s blog pretty helpful on the new way of finding out when things are ready:

https://odoe.net/blog/quick-tip-arcgis-api-4-js-stuff-ready/ 

View solution in original post

2 Replies
KenBuja
MVP Esteemed Contributor

I've found Rene Rubalcava‌'s blog pretty helpful on the new way of finding out when things are ready:

https://odoe.net/blog/quick-tip-arcgis-api-4-js-stuff-ready/ 

DavidKucharski
New Contributor II

Thank you. That did it.

0 Kudos