mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-12-25 13:53:48 +01:00
Save indexDB to window.indexDB automaticaly to avoid re-created it
This commit is contained in:
parent
de8648e5f1
commit
6eb8717f55
@ -126,7 +126,7 @@ draft: false
|
|||||||
|
|
||||||
window.defaultDats = window.defaultDats.concat(sub)
|
window.defaultDats = window.defaultDats.concat(sub)
|
||||||
}
|
}
|
||||||
window.indexDB = await indexDB.loadAsync()
|
await indexDB.loadAsync()
|
||||||
window.defaultDats = window.defaultDats.sort((datfA, datfB) => {
|
window.defaultDats = window.defaultDats.sort((datfA, datfB) => {
|
||||||
const exSetA = datfA.set
|
const exSetA = datfA.set
|
||||||
const exSetB = datfB.set
|
const exSetB = datfB.set
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
class indexDB {
|
class indexDB {
|
||||||
static async loadAsync() {
|
static async loadAsync() {
|
||||||
|
if (window.indexDB) {
|
||||||
|
return window.indexDB
|
||||||
|
}
|
||||||
var db = new indexDB
|
var db = new indexDB
|
||||||
const maxAge= (DebugMode.Enabled,0,600)
|
const maxAge= (DebugMode.Enabled,0,600)
|
||||||
const text = await getTextFromFileUrlAsync("/data/index.yaml",{"Cache-Control":`max-age=${maxAge}`})
|
const text = await getTextFromFileUrlAsync("/data/index.yaml",{"Cache-Control":`max-age=${maxAge}`})
|
||||||
const myYaml = jsyaml.load(text);
|
const myYaml = jsyaml.load(text);
|
||||||
db.sets = ((myYaml.sets === null) ? new Map() : new Map(Object.entries(myYaml.sets)));
|
db.sets = ((myYaml.sets === null) ? new Map() : new Map(Object.entries(myYaml.sets)));
|
||||||
db.others = ((myYaml.others === null) ? [] : Array.from(myYaml.others));
|
db.others = ((myYaml.others === null) ? [] : Array.from(myYaml.others));
|
||||||
|
window.indexDB=db
|
||||||
return db
|
return db
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user