MapComplete/src/index.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.2 KiB
TypeScript
Raw Normal View History

import DetermineTheme from "./Logic/DetermineTheme"
2025-01-23 14:27:02 +01:00
import SingleThemeGui from "./UI/SingleThemeGui.svelte"
import CustomThemeError from "./UI/CustomThemeError.svelte"
2024-02-18 15:59:28 +01:00
async function main() {
const target = document.getElementById("maindiv")
const childs = Array.from(target.children)
2025-01-30 14:50:40 +01:00
try {
childs.forEach((ch) => target.removeChild(ch))
} catch (e) {
console.error("Huh? Couldn't remove child!")
}
2024-02-18 15:59:28 +01:00
try {
document.getElementById("maindiv").innerHTML = "<div class='delete-on-load w-full flex justify-center my-16'>Loading map...</div>"
const theme = await DetermineTheme.getTheme()
new SingleThemeGui({
2024-06-18 03:33:11 +02:00
target,
2025-01-28 15:42:34 +01:00
props: { theme },
})
2024-04-13 02:40:21 +02:00
Array.from(document.getElementsByClassName("delete-on-load")).forEach((el) => {
2024-03-21 22:39:36 +01:00
el.parentElement.removeChild(el)
})
2024-02-18 15:59:28 +01:00
} catch (err) {
console.error("Error while initializing: ", err, err.stack)
const customDefinition = DetermineTheme.getCustomDefinition()
new CustomThemeError({
target,
props: {
stack: err.toString().split("\n"),
2025-01-28 15:42:34 +01:00
customDefinition,
},
})
2024-02-18 15:59:28 +01:00
}
}
2024-02-18 15:59:28 +01:00
main().then(() => {})