HOW TO
The base class for all layers in ArcGIS API for JavaScript 3.x provides a 'refreshInterval' property, which allows the layer to automatically refresh at the set interval.
The following instructions describe how to auto-refresh a feature layer periodically using ArcGIS API for JavaScript 3.20. All classes that inherit from the base class Layer have access to the refreshInterval property and the setRefreshInterval() method. Hence, the refresh interval can be set on a graphics layer and a dynamic map service layer the same way.
var featureLayer = new FeatureLayer("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/0"); featureLayer.setRefreshInterval(1); //Set the interval to 1 minute map.addLayer(featureLayer);
var featureLayer = new FeatureLayer("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/0", { mode: FeatureLayer.MODE_ONDEMAND, refreshInterval: 1, //Set the interval to 1 minute });
Article ID: 000013384
Get help from ArcGIS experts
Download the Esri Support App