Add cache timeout

This commit is contained in:
Pieter Vander Vennet 2021-04-17 15:42:22 +02:00
parent 823768bbc9
commit 576fd8ff40
5 changed files with 30 additions and 1 deletions

View file

@ -15,6 +15,10 @@ export default class LocalStorageSaver implements FeatureSource {
this.features = source.features;
this.features.addCallbackAndRun(features => {
const now = new Date().getTime()
features = features.filter(f => layout.data.cacheTimeout > Math.abs(now - f.freshness.getTime())/1000)
if (features === undefined) {
return;
}