AnsweredAssumed Answered

Error handling with an Arcgis Online map (javascript api 4.16)

Question asked by nault-beaucaire.fabien@hydroquebec.com_hqvptigeo on Oct 2, 2020
Latest reply on Oct 2, 2020 by odoe

I have an Arcgis Online map which use refreshInterval for automatic updates.

I need to intercept an event when the network goes offline or online, like it’s done in the Map Viewer with the orange triangle at the bottom left (when I put the Network to Offline with Chrome developer tools):

 

Error icon on Map viewer when network goes offline 

 

I tried to capture an error event on the map and on the layers, but it’s not working (with javascript api 4.16, in angular):

 

  const webMap = new this._WebMap({

            portalItem: {

                id: arcgisOnlineMapId

            }

        });

 

        this.mapView = new this._MapView({

            container: this.mapViewEl.nativeElement,

            map: webMap

        });

 

        await this.mapView.when();

 

  this.mapView.on('error', (error) => {

            console.error(`mapView error: ${error}`);

        });

 

        this.mapView.map.layers.on('error', (error) => {

            console.error(`layers error: ${error}`);

        });

 

How can I do that ?

Same question for an event when the network comes back.

 

Thanks !

Outcomes