From 404fa3c4067e683fd9084fdb2d462f77adc9cf0c Mon Sep 17 00:00:00 2001 From: mkelvers Date: Thu, 4 Jun 2026 11:28:06 +0200 Subject: [PATCH] feat: add htmx type declarations and process on ready --- static/htmx.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) 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); });