Performance: prepare dropping the NSI-logos from the repo

This commit is contained in:
Pieter Vander Vennet 2025-04-27 02:57:12 +02:00
parent 164b02c8ff
commit 555075edfe
3 changed files with 17 additions and 26 deletions

View file

@ -262,14 +262,15 @@ export class NameSuggestionIndexLight {
if (NameSuggestionIndexLight.initedLight) {
return NameSuggestionIndexLight.initedLight
}
const endpoint = Constants.nsiLogosEndpoint ?? "./assets/data/nsi/"
const [nsi, features] = await Promise.all(
[
"./assets/data/nsi/nsi.min.json",
"./assets/data/nsi/featureCollection.min.json"
endpoint + "nsi.min.json",
endpoint + "featureCollection.min.json"
].map((url) => Utils.downloadJsonCached(url, 1000 * 60 * 60 * 24 * 30))
)
return new NameSuggestionIndexLight(
Constants.nsiLogosEndpoint,
endpoint,
<any>nsi,
<any>features
)
@ -310,15 +311,16 @@ export default class NameSuggestionIndex extends NameSuggestionIndexLight {
}
public static async getNsiIndex(): Promise<NameSuggestionIndex> {
public static async getNsiIndex(endPoint ?: string): Promise<NameSuggestionIndex> {
if (NameSuggestionIndex.inited) {
return NameSuggestionIndex.inited
}
endPoint ??= Constants.nsiLogosEndpoint ?? "./assets/data/nsi/"
const [nsi, nsiWd, features] = await Promise.all(
[
"./assets/data/nsi/nsi.min.json",
"./assets/data/nsi/wikidata.min.json",
"./assets/data/nsi/featureCollection.min.json"
endPoint + "nsi.min.json",
endPoint + "wikidata.min.json",
endPoint + "featureCollection.min.json"
].map((url) => Utils.downloadJsonCached(url, 1000 * 60 * 60 * 24 * 30))
)
return new NameSuggestionIndex(