refactor: replace DOMContentLoaded with onReady utility

This commit is contained in:
2026-06-06 16:51:07 +02:00
parent 5019e9fcb7
commit 392bc10b99
2 changed files with 6 additions and 6 deletions

View File

@@ -1,3 +1,5 @@
import { onReady } from "./utils";
const initSortFilter = (): void => {
const sortSelect = document.getElementById("sort-select") as HTMLSelectElement | null;
const orderSelect = document.getElementById("order-select") as HTMLSelectElement | null;
@@ -21,4 +23,4 @@ const initSortFilter = (): void => {
});
};
document.addEventListener("DOMContentLoaded", initSortFilter);
onReady(initSortFilter);

View File

@@ -1,3 +1,5 @@
import { onReady } from "./utils";
type Theme = "light" | "dark";
const colorSchemeQuery = window.matchMedia?.("(prefers-color-scheme: dark)") ?? null;
@@ -17,8 +19,4 @@ const initTheme = (): void => {
colorSchemeQuery?.addEventListener("change", () => applyTheme(getPreferredTheme()));
};
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", initTheme);
} else {
initTheme();
}
onReady(initTheme);