refactor: migrate from htmx:afterSwap to onHtmxLoad

This commit is contained in:
2026-06-06 16:51:12 +02:00
parent 392bc10b99
commit 78b36452ae
4 changed files with 25 additions and 27 deletions

View File

@@ -1,3 +1,4 @@
import { onHtmxLoad, onReady } from "./utils";
import { isJstTimezone, normalizeWeekday, parseHHMM } from "./shared/broadcast";
export {};
@@ -328,13 +329,13 @@ const buildBoard = (section: HTMLElement): void => {
};
const initScheduleBoard = (): void => {
const run = (): void => {
const sections = document.querySelectorAll<HTMLElement>("[data-schedule-section]");
const run = (root: ParentNode): void => {
const sections = root.querySelectorAll<HTMLElement>("[data-schedule-section]");
sections.forEach(buildBoard);
};
document.addEventListener("DOMContentLoaded", run);
document.body.addEventListener("htmx:afterSwap", run);
onReady(() => run(document));
onHtmxLoad((root) => run(root));
};
initScheduleBoard();