@opengeoweb/webmap-react 9.33.0 → 9.33.1-spike-ol.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +32 -31
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -9820,15 +9820,11 @@ class ReactMapView extends React.Component {
|
|
|
9820
9820
|
const autoFetchInterval = Number(shouldAutoFetch); // Default true -> 1 minute
|
|
9821
9821
|
const autoFetchIntervalMilliSeconds = Math.abs(autoFetchInterval) * MINUTE_TO_MILLISECOND;
|
|
9822
9822
|
if (document.visibilityState === 'visible') {
|
|
9823
|
-
if
|
|
9824
|
-
|
|
9825
|
-
|
|
9823
|
+
// Check if the last refetch time is not set or if the time since the last refetch exceeds the interval
|
|
9824
|
+
if (!this.lastRefetched || new Date().getTime() - this.lastRefetched > autoFetchIntervalMilliSeconds) {
|
|
9825
|
+
// Refetch immediately and restart the timer
|
|
9826
9826
|
this.onStartRefetchTimer(true);
|
|
9827
|
-
} else {
|
|
9828
|
-
this.onStartRefetchTimer();
|
|
9829
9827
|
}
|
|
9830
|
-
} else {
|
|
9831
|
-
this.clearRefetchTimer();
|
|
9832
9828
|
}
|
|
9833
9829
|
};
|
|
9834
9830
|
/**
|
|
@@ -9846,31 +9842,36 @@ class ReactMapView extends React.Component {
|
|
|
9846
9842
|
this.clearRefetchTimer();
|
|
9847
9843
|
const autoFetchInterval = Number(shouldAutoFetch); // Default true -> 1 minute
|
|
9848
9844
|
const refetch = () => {
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9845
|
+
const isVisible = document.visibilityState === 'visible';
|
|
9846
|
+
if (isVisible) {
|
|
9847
|
+
this.lastRefetched = new Date().getTime();
|
|
9848
|
+
const {
|
|
9849
|
+
mapId
|
|
9850
|
+
} = this.props;
|
|
9851
|
+
const wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
9852
|
+
const layers = wmjsMap == null ? void 0 : wmjsMap.getLayers();
|
|
9853
|
+
layers == null || layers.forEach(layer => {
|
|
9854
|
+
if (layer.enabled !== false) {
|
|
9855
|
+
parseWMJSLayer(layer, true).then(wmLayer => {
|
|
9856
|
+
const {
|
|
9857
|
+
props
|
|
9858
|
+
} = this;
|
|
9859
|
+
const {
|
|
9860
|
+
mapId,
|
|
9861
|
+
onUpdateLayerInformation
|
|
9862
|
+
} = props;
|
|
9863
|
+
const layerInfo = getLayerUpdateInfo(wmLayer, mapId);
|
|
9864
|
+
onUpdateLayerInformation && onUpdateLayerInformation(layerInfo);
|
|
9865
|
+
}).catch(e => {
|
|
9866
|
+
console.error(e);
|
|
9867
|
+
});
|
|
9868
|
+
}
|
|
9869
|
+
});
|
|
9870
|
+
}
|
|
9872
9871
|
};
|
|
9873
|
-
|
|
9872
|
+
if (autoFetchInterval > 0) {
|
|
9873
|
+
this.refetchTimer = setInterval(refetch, Math.abs(autoFetchInterval) * MINUTE_TO_MILLISECOND);
|
|
9874
|
+
}
|
|
9874
9875
|
if (force) {
|
|
9875
9876
|
refetch();
|
|
9876
9877
|
}
|