Skip to content

Commit

Permalink
Closes bigskysoftware#74: Ability to differentiate response based on …
Browse files Browse the repository at this point in the history
…triggering event
  • Loading branch information
aral authored Aug 12, 2024
1 parent 84f5cb7 commit 359da12
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ws/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ This extension adds support for WebSockets to htmx. See /www/extensions/ws.md f
socketWrapper: socketWrapper.publicInterface
}

// Add triggering event to headers so authors can
// differentiate what caused the trigger when listening for
// multiple events (e.g., a swipe-left versus a swipe-right).
headers['HX-Trigger-Event'] = sendConfig.triggeringEvent.type

if (!api.triggerEvent(elt, 'htmx:wsConfigSend', sendConfig)) {
return
}
Expand Down

0 comments on commit 359da12

Please sign in to comment.