2020-09-20 17:53:58 +02:00
|
|
|
class indexDB {
|
|
|
|
static async loadAsync() {
|
2020-11-01 16:57:16 +01:00
|
|
|
if (window.indexDB) {
|
|
|
|
return window.indexDB
|
|
|
|
}
|
2020-09-20 17:53:58 +02:00
|
|
|
var db = new indexDB
|
2020-11-01 16:54:57 +01:00
|
|
|
const maxAge= (DebugMode.Enabled,0,600)
|
|
|
|
const text = await getTextFromFileUrlAsync("/data/index.yaml",{"Cache-Control":`max-age=${maxAge}`})
|
2020-09-20 17:53:58 +02:00
|
|
|
const myYaml = jsyaml.load(text);
|
|
|
|
db.sets = ((myYaml.sets === null) ? new Map() : new Map(Object.entries(myYaml.sets)));
|
2020-11-01 16:18:00 +01:00
|
|
|
db.others = ((myYaml.others === null) ? [] : Array.from(myYaml.others));
|
2020-11-01 16:57:16 +01:00
|
|
|
window.indexDB=db
|
2020-09-20 17:53:58 +02:00
|
|
|
return db
|
|
|
|
}
|
|
|
|
}
|