From 5a92edc6b06b6866111ef658deb95c7303d345a9 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Tue, 16 Jun 2026 01:33:36 +0200 Subject: [PATCH] add FunctionBase::trigger_htmx_event() with a string parameter --- winixd/functions/functionbase.cpp | 12 +++++++++++- winixd/functions/functionbase.h | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/winixd/functions/functionbase.cpp b/winixd/functions/functionbase.cpp index 7662178..113e35f 100644 --- a/winixd/functions/functionbase.cpp +++ b/winixd/functions/functionbase.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2010-2024, Tomasz Sowa + * Copyright (c) 2010-2026, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1154,6 +1154,16 @@ void FunctionBase::trigger_htmx_event(const wchar_t * event_name, long value) } +void FunctionBase::trigger_htmx_event(const wchar_t * event_name, const wchar_t * value) +{ + if( cur->request->is_htmx_request ) + { + pt::Space & trigger = cur->request->out_headers.get_add_space(L"HX-Trigger"); + trigger.add(event_name, value); + } +} + + /* * DEPRACATED * for backward compatibility diff --git a/winixd/functions/functionbase.h b/winixd/functions/functionbase.h index f4733b7..e3359d0 100644 --- a/winixd/functions/functionbase.h +++ b/winixd/functions/functionbase.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2010-2024, Tomasz Sowa + * Copyright (c) 2010-2026, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -242,6 +242,7 @@ public: virtual void trigger_htmx_event(const wchar_t * event_name, bool value); virtual void trigger_htmx_event(const wchar_t * event_name, int value); virtual void trigger_htmx_event(const wchar_t * event_name, long value); + virtual void trigger_htmx_event(const wchar_t * event_name, const wchar_t * value);