Show a loading indicator in the ArcGIS JavaScript API v4

It's not obvious how to display a "loading" indicator while the map is working, when using the ArcGIS JS API version 4.

The trick is to use the new watchUtils utility, and set it to watch for the mapView's updating property:

watchUtils.whenTrue(view, "updating"....

You can use the whenTrue option to display the loading indicator, and the whenFalse option to hide it again. See the demo at https://codepen.io/slead/pen/QYwNJo

Back to articles

CONTACT