Skip to content
Types
import type { RefreshableLayer } from "@arcgis/core/layers/mixins/RefreshableLayer.js";
Subclasses:
BaseDynamicLayer, BaseTileLayer, CSVLayer, CatalogLayer, FeatureLayer, GeoJSONLayer, GeoRSSLayer, ImageryLayer, ImageryTileLayer, KMLLayer, KnowledgeGraphLayer, MapImageLayer, OGCFeatureLayer, WebTileLayer, StreamLayer, SubtypeGroupLayer, TileLayer, VectorTileLayer, WCSLayer, WFSLayer, WMSLayer, WMTSLayer, KnowledgeGraphSublayer
Since
ArcGIS Maps SDK for JavaScript 4.6

Mixin for layers that support refresh and refreshInterval.

Properties

PropertyTypeClass

refreshInterval

Property
Type
number

Refresh interval of the layer in minutes. Value of 0 indicates no refresh.

See also
Default value
0
Example
// the layer will be refreshed every minute.
layer.refreshInterval = 1;

Methods

MethodSignatureClass
refresh(): void

refresh

Method
Signature
refresh (): void

Fetches all the data for the layer.

See also
Returns
void

Events

refresh

Event
Since
ArcGIS Maps SDK for JavaScript 4.21

Fires if the layer has the refreshInterval set or when refresh() method is called. The event payload indicates if the layer's data has changed.

See also
bubbles composed cancelable
Examples
// listen to layer's refresh event to fetch the attachments
// for the updated features.
layer.on("refresh", async (event) =>{
if (!event.dataChanged){
return;
}
try {
const query = layer.createQuery();
const objectIds = await layer.queryObjectIds(query);
let attachmentQuery = {
objectIds: objectIds,
definitionExpression: layer.definitionExpression,
attachmentTypes: ["image/jpeg"]
};
const attachments = await layer.queryAttachments(attachmentQuery);
attachmentQuery.objectIds.forEach(function (objectId) {
if (attachments[objectId]) {
// process the updated attachments
let attachment = attachments[objectId];
console.log("Attachments for objectId ", objectId, attachment);
}
});
} catch (error) {
console.log("attachment query error", error);
}
});
// listen to layer's refresh event to fetch object ids of completed features
layer.on("refresh", function(event){
if (event.dataChanged){
const query = layer.createQuery();
query.where = "Status = 'Completed'";
layer.queryObjectIds(query).then((objectIds) => {
// process returned features
});
}
});

Type definitions

RefreshEvent

Type definition

dataChanged

Property
Type
boolean | undefined

Indicates if the layer's data has changed.