diff --git a/src/app/App.ts b/src/app/App.ts index 9eda1275..00af6203 100644 --- a/src/app/App.ts +++ b/src/app/App.ts @@ -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) => { diff --git a/src/app/Router.ts b/src/app/Router.ts index dcc1c395..cea4fbc1 100644 --- a/src/app/Router.ts +++ b/src/app/Router.ts @@ -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') diff --git a/src/app/state/Property.ts b/src/app/state/Property.ts index a5dc4fa2..66fb3705 100644 --- a/src/app/state/Property.ts +++ b/src/app/state/Property.ts @@ -37,4 +37,8 @@ export class Property { } return this } + + trigger() { + this.watchers.forEach(w => w.watcher(this.value, null)) + } }