Load schemas after DOM content is loaded

This commit is contained in:
Misode
2021-05-28 03:34:44 +02:00
parent f02221bf43
commit b7150b014f
3 changed files with 9 additions and 3 deletions

View File

@@ -73,13 +73,14 @@ export const App = {
settings: new Settings('generator_settings'),
blockStateRegistry: {} as BlockStateRegistry
}
console.debug(`[App] LocalStorage=${'localStorage' in window} Caches=${'caches' in window}`)
App.version.watchRun(async (value) => {
console.debug(`[App.version.watchRun] ${value}`)
App.version.watch(async (value) => {
console.debug(`[App.version.watch] ${value}`)
App.schemasLoaded.set(false)
await updateSchemas(value)
App.schemasLoaded.set(true)
console.debug(`[App.version.watchRun] Done! ${value}`)
console.debug(`[App.version.watch] Done! ${value}`)
})
App.theme.watchRun((value) => {

View File

@@ -66,6 +66,7 @@ window.addEventListener("popstate", router);
document.addEventListener("DOMContentLoaded", () => {
console.debug(`[DOMContentLoaded] LocalStorage=${'localStorage' in window} Caches=${'caches' in window}`)
App.version.trigger()
document.body.addEventListener("click", e => {
if (e.target instanceof Element
&& e.target.hasAttribute('data-link')

View File

@@ -37,4 +37,8 @@ export class Property<T> {
}
return this
}
trigger() {
this.watchers.forEach(w => w.watcher(this.value, null))
}
}