Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support object events for addTrigger in addition to strings #13

Closed
sbrow opened this issue Nov 16, 2023 · 0 comments · Fixed by #14
Closed

Support object events for addTrigger in addition to strings #13

sbrow opened this issue Nov 16, 2023 · 0 comments · Fixed by #14

Comments

@sbrow
Copy link

sbrow commented Nov 16, 2023

The htmx docs for HX-Trigger state that events can be strings, but can also be any JSON serializable value.

Would you be open to a PR in this regard?

Example


Input:

with(new HtmxResponse())->addTrigger('showMessage', ['level' => 'info', 'message', 'Here Is A Message'])

Output:

HX-Trigger: {"showMessage":{"level" : "info", "message" : "Here Is A Message"}}

What would happen if you call addTrigger with the same event name twice is up for debate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant