File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,6 +155,10 @@ This extension adds support for Server Sent Events to htmx. See /www/extensions
155155 } , timeout ) ;
156156 }
157157 } ;
158+
159+ source . onopen = function ( evt ) {
160+ api . triggerEvent ( elt , "htmx::sseOpen" , { source : source } ) ;
161+ }
158162
159163 // Add message handlers for every `sse-swap` attribute
160164 queryAttributeOnThisOrChildren ( elt , "sse-swap" ) . forEach ( function ( child ) {
Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ The table below lists all other attributes available in htmx.
159159| [ ` htmx:pushedIntoHistory ` ] ( /events#htmx:pushedIntoHistory ) | triggered after an url is pushed into history
160160| [ ` htmx:responseError ` ] ( /events#htmx:responseError ) | triggered when an HTTP response error (non-` 200 ` or ` 300 ` response code) occurs
161161| [ ` htmx:sendError ` ] ( /events#htmx:sendError ) | triggered when a network error prevents an HTTP request from happening
162+ | [ ` htmx:sseOpen ` ] ( /events#htmx:sseOpen ) | triggered when a SSE source is opened
162163| [ ` htmx:sseError ` ] ( /events#htmx:sseError ) | triggered when an error occurs with a SSE source
163164| [ ` htmx:swapError ` ] ( /events#htmx:swapError ) | triggered when an error occurs during the swap phase
164165| [ ` htmx:targetError ` ] ( /events#htmx:targetError ) | triggered when an invalid target is specified
You can’t perform that action at this time.
0 commit comments