JAPI 4.x - ETA on layer-loading event ('update-end' event in 3.x)

1564
4
Jump to solution
08-17-2017 04:22 AM
KevinHaeni
New Contributor III

In the JSAPI 3.x is was possible to show progress indicators while a (feature) layer was loading - thanks to the update-end event.

Unfortunately, I do not find an equivalent in 4.4 yet.

Any plans to implement this (and quite a few other events that are still missing) soon?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
4 Replies
KenBuja
MVP Esteemed Contributor
KevinHaeni
New Contributor III

Thank you for the link! This seems to be what I've been looking for:

self.mapView.whenLayerView(fl).then(layerView => {
    watchUtils.whenFalse(layerView, 'updating', () => {
        console.log('The layer is now visible!');
    });
});
0 Kudos
ThomasSolow
Occasional Contributor III

In the 4.XX API, layers are promises.  

let fLayer = new FeatureLayer({url: ...});
map.layers.add(flayer);
fLayer.then(fl => console.log('layer is loaded'));
0 Kudos
KevinHaeni
New Contributor III

Thank you. However, the layer promise seems to get resolved as soon as the layer object is created and not when it has been loaded to the map.

So 'layer is loaded' is displayed almost instantly and the layer might still load data from the mapservice and is busy displaying them in the map.

0 Kudos