forked from MapComplete/MapComplete
Wire in aspected-routing as calculated tag
This commit is contained in:
parent
829efc5d55
commit
e0b71ca53e
10 changed files with 14806 additions and 84 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue