mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-30 09:42:44 +00:00
Load schemas after DOM content is loaded
This commit is contained in:
@@ -73,13 +73,14 @@ export const App = {
|
|||||||
settings: new Settings('generator_settings'),
|
settings: new Settings('generator_settings'),
|
||||||
blockStateRegistry: {} as BlockStateRegistry
|
blockStateRegistry: {} as BlockStateRegistry
|
||||||
}
|
}
|
||||||
|
console.debug(`[App] LocalStorage=${'localStorage' in window} Caches=${'caches' in window}`)
|
||||||
|
|
||||||
App.version.watchRun(async (value) => {
|
App.version.watch(async (value) => {
|
||||||
console.debug(`[App.version.watchRun] ${value}`)
|
console.debug(`[App.version.watch] ${value}`)
|
||||||
App.schemasLoaded.set(false)
|
App.schemasLoaded.set(false)
|
||||||
await updateSchemas(value)
|
await updateSchemas(value)
|
||||||
App.schemasLoaded.set(true)
|
App.schemasLoaded.set(true)
|
||||||
console.debug(`[App.version.watchRun] Done! ${value}`)
|
console.debug(`[App.version.watch] Done! ${value}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
App.theme.watchRun((value) => {
|
App.theme.watchRun((value) => {
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ window.addEventListener("popstate", router);
|
|||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
console.debug(`[DOMContentLoaded] LocalStorage=${'localStorage' in window} Caches=${'caches' in window}`)
|
console.debug(`[DOMContentLoaded] LocalStorage=${'localStorage' in window} Caches=${'caches' in window}`)
|
||||||
|
App.version.trigger()
|
||||||
document.body.addEventListener("click", e => {
|
document.body.addEventListener("click", e => {
|
||||||
if (e.target instanceof Element
|
if (e.target instanceof Element
|
||||||
&& e.target.hasAttribute('data-link')
|
&& e.target.hasAttribute('data-link')
|
||||||
|
|||||||
@@ -37,4 +37,8 @@ export class Property<T> {
|
|||||||
}
|
}
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trigger() {
|
||||||
|
this.watchers.forEach(w => w.watcher(this.value, null))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user