Wire in aspected-routing as calculated tag

This commit is contained in:
Pieter Vander Vennet 2021-07-26 20:21:05 +02:00
parent 829efc5d55
commit e0b71ca53e
10 changed files with 14806 additions and 84 deletions

View file

@ -166,4 +166,21 @@ export class UIEventSource<T> {
}
})
}
}
export class UIEventSourceTools {
private static readonly _download_cache = new Map<string, UIEventSource<any>>()
public static downloadJsonCached(url: string): UIEventSource<any>{
const cached = UIEventSourceTools._download_cache.get(url)
if(cached !== undefined){
return cached;
}
const src = new UIEventSource<any>(undefined)
UIEventSourceTools._download_cache.set(url, src)
Utils.downloadJson(url).then(r => src.setData(r))
return src;
}
}