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
| Property | Type | Class |
|---|---|---|
| |
refreshInterval
Property
- Type
- number
Refresh interval of the layer in minutes. Value of 0 indicates no refresh.
- Default value
- 0
- Example
- // the layer will be refreshed every minute.layer.refreshInterval = 1;
Methods
| Method | Signature | Class |
|---|---|---|
| refresh(): void | |
Events
| Name | Type |
|---|---|
refresh
Event
refresh: CustomEvent<RefreshEvent> - 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.
- 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 attachmentslet 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 featureslayer.on("refresh", function(event){if (event.dataChanged){const query = layer.createQuery();query.where = "Status = 'Completed'";layer.queryObjectIds(query).then((objectIds) => {// process returned features});}});