add FunctionBase::trigger_htmx_event() with a string parameter

This commit is contained in:
2026-06-16 01:33:36 +02:00
parent c32ed6ce28
commit 5a92edc6b0
2 changed files with 13 additions and 2 deletions
+11 -1
View File
@@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (c) 2010-2024, Tomasz Sowa * Copyright (c) 2010-2026, Tomasz Sowa
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * 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 * DEPRACATED
* for backward compatibility * for backward compatibility
+2 -1
View File
@@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (c) 2010-2024, Tomasz Sowa * Copyright (c) 2010-2026, Tomasz Sowa
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * 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, bool value);
virtual void trigger_htmx_event(const wchar_t * event_name, int 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, long value);
virtual void trigger_htmx_event(const wchar_t * event_name, const wchar_t * value);