From f02221bf435375054007102db931351ac6183035 Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 28 May 2021 03:27:21 +0200 Subject: [PATCH] More debugging --- src/app/App.ts | 5 +++++ src/app/Router.ts | 7 +++++-- src/app/views/View.ts | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/App.ts b/src/app/App.ts index d2e1f5db..9eda1275 100644 --- a/src/app/App.ts +++ b/src/app/App.ts @@ -118,11 +118,15 @@ App.mobilePanel.watchRun((value) => { }) async function updateSchemas(version: string) { + console.debug(`[updateSchemas] ${version}`) App.blockStateRegistry = {} const collections = Versions[version].getCollections() + console.debug(`[updateSchemas] Done getting collections! ${Object.keys(collections['registry']).length}`) App.collections.set(collections) await fetchData(collections, version) + console.debug('[updateSchemas] Done fetching data!') const schemas = Versions[version].getSchemas(collections) + console.debug(`[updateSchemas] Done getting schemas! ${Object.keys(schemas['registry']).length}`) config.models .filter(m => m.schema) .filter(m => checkVersion(App.version.get(), m.minVersion)) @@ -138,6 +142,7 @@ async function updateSchemas(version: string) { } } }) + console.debug(`[updateSchemas] Done!`) } async function updateLocale(language: string) { diff --git a/src/app/Router.ts b/src/app/Router.ts index 75cf236f..dcc1c395 100644 --- a/src/app/Router.ts +++ b/src/app/Router.ts @@ -16,8 +16,6 @@ const router = async () => { const urlParts = location.pathname.split('/').filter(e => e) const urlParams = new URLSearchParams(location.search) console.debug(`[router] ${urlParts.join('/')}`) - console.debug(`[router] LocalStorage? ${'localStorage' in window}`) - console.debug(`[router] Caches? ${'caches' in window}`) const target = document.getElementById('app')! let title = locale('title.home') @@ -51,18 +49,23 @@ const router = async () => { } } + console.debug(`[router] Renderer=${renderer.name}`) + const versions = config.versions .filter(v => checkVersion(v.id, App.model.get()?.minVersion)) .map(v => v.id).join(', ') document.title = `${title} Minecraft ${versions}` + console.debug(`[router] Title=${title} Versions=${versions}`) App.mobilePanel.set(panel) const view = new View() view.mount(target, renderer(view), true) + console.debug(`[router] Done!`) } window.addEventListener("popstate", router); document.addEventListener("DOMContentLoaded", () => { + console.debug(`[DOMContentLoaded] LocalStorage=${'localStorage' in window} Caches=${'caches' in window}`) document.body.addEventListener("click", e => { if (e.target instanceof Element && e.target.hasAttribute('data-link') diff --git a/src/app/views/View.ts b/src/app/views/View.ts index 4833cb42..061c3ab2 100644 --- a/src/app/views/View.ts +++ b/src/app/views/View.ts @@ -53,6 +53,7 @@ export class View implements Mounter{ } mount(el: Element, html: string, clear = true) { + console.debug(`[View.mount] ${html.replace(/\n/g,'').slice(0, 40)}...`) el.innerHTML = html this.mounted(el, clear) }