diff --git a/static/htmx.ts b/static/htmx.ts index 9a2aeb9..cadda86 100644 --- a/static/htmx.ts +++ b/static/htmx.ts @@ -2,6 +2,14 @@ export {}; import { onReady } from "./utils"; +declare global { + interface Window { + htmx?: { + process: (element: Element) => void; + }; + } +} + type ToastFn = (opts: { message: string; duration?: number }) => void; const getToast = (): ToastFn | null => { @@ -36,6 +44,8 @@ const getTriggerFromHtmxEvent = (event: Event): Element | null => { }; onReady(() => { + window.htmx?.process(document.body); + document.addEventListener("htmx:beforeRequest", (event) => { setBusy(getTriggerFromHtmxEvent(event), true); });