bigskysoftware / bigskysoftware/htmx-extensions

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

Open
#74 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
284
Forks
88
PR merge metrics
No merged PRs in 30d

Description

## 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'
```

Contributor guide

Open the contributing guide

Research direction

Start at the websocket extension entry point that handles hx-trigger events and assembles HEADERS for messages. Trace how triggeringEvent is available there and verify the header format against the existing message flow. Done means the triggering event type is sent as HX-Trigger-Event so the server can distinguish swiped-left from swiped-right.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.