bigskysoftware / htmx-extensions

164 stars 50 forks source link

[ws] [ECR] Ability to differentiate response based on triggering event #74

Open aral opened 3 months ago

aral commented 3 months ago

Use case:

I have an element that can either be swiped left or swiped right. It’s hx-trigger looks like this:

hx-trigger='swiped-left, swiped-right'

On the server, I can’t differentiate whether it was a swipe left or swipe right.

Suggested enhancement

Add the triggeringEvent’s type to the HEADERS that are sent with the message so I can differentiate between a swipe left and swipe right on my element.

e.g., the header could be:

 'HX-Trigger-Event': 'swiped-right'