Mark,
No the refresh has to set on the FeatureLayer.
FeatureLayer | API Reference | ArcGIS API for JavaScript 3.18 | setRefreshInterval
So you will need to get the layer object in WAB and set call the setRefreshInterval method.
So for WAB this would be done in the MapManager.js (my addition is commended below):
_show2DWebMap: function(appConfig) {
//should use appConfig instead of this.appConfig, because appConfig is new.
// if (appConfig.portalUrl) {
// var url = portalUrlUtils.getStandardPortalUrl(appConfig.portalUrl);
// agolUtils.arcgisUrl = url + "/sharing/content/items/";
// }
if(!appConfig.map.mapOptions){
appConfig.map.mapOptions = {};
}
var mapOptions = this._processMapOptions(appConfig.map.mapOptions) || {};
mapOptions.isZoomSlider = false;
var webMapPortalUrl = appConfig.map.portalUrl;
var webMapItemId = appConfig.map.itemId;
var webMapOptions = {
mapOptions: mapOptions,
bingMapsKey: appConfig.bingMapsKey,
usePopupManager: true
};
if(!window.isBuilder && !appConfig.mode && appConfig.map.appProxy &&
appConfig.map.appProxy.mapItemId === appConfig.map.itemId) {
var layerMixins = [];
array.forEach(appConfig.map.appProxy.proxyItems, function(proxyItem){
if (proxyItem.useProxy && proxyItem.proxyUrl) {
layerMixins.push({
url: proxyItem.sourceUrl,
mixin: {
url: proxyItem.proxyUrl
}
});
}
});
if(layerMixins.length > 0) {
webMapOptions.layerMixins = layerMixins;
}
}
var mapDeferred = jimuUtils.createWebMap(webMapPortalUrl, webMapItemId,
this.mapDivId, webMapOptions);
mapDeferred.then(lang.hitch(this, function(response) {
var map = response.map;
//hide the default zoom slider
map.hideZoomSlider();
// set default size of infoWindow.
map.infoWindow.resize(270, 316);
//var extent;
map.itemId = appConfig.map.itemId;
map.itemInfo = response.itemInfo;
map.webMapResponse = response;
// enable snapping
var options = {
snapKey: keys.copyKey
};
map.enableSnapping(options);
html.setStyle(map.root, 'zIndex', 0);
map._initialExtent = map.extent;
LayerInfos.getInstance(map, map.itemInfo).then(lang.hitch(this, function(layerInfosObj) {
this.layerInfosObj = layerInfosObj;
//My addition to do a refresh on the layer
array.some(layerInfosObj._finalLayerInfos, lang.hitch(this, function(layer){
if(layer.title === "CountyCrimeMap - Crimes"){
layer.layerObject.setRefreshInterval(10); //the interval is in minutes
return true;
}
}));
//end my add
this._publishMapEvent(map);
setTimeout(lang.hitch(this, this._checkAppState), 500);
this.loading.hide();
this._addDataLoadingOnMapUpdate(map);
}));
}), lang.hitch(this, function() {
this._destroyLoadingShelter();
topic.publish('mapCreatedFailed');
}));
},