diff --git a/src/Tests/ViewEngine.fs b/src/Tests/ViewEngine.fs index a7f9146..2ca87c6 100644 --- a/src/Tests/ViewEngine.fs +++ b/src/Tests/ViewEngine.fs @@ -811,6 +811,12 @@ let attributes = test "_hxWs succeeds" { ul [ _hxWs "connect:/web-socket" ] [] |> shouldRender """""" } + test "_sseSwap succeeds" { + ul [ _sseSwap "sseMessageName" ] [] |> shouldRender """""" + } + test "_sseConnect succeeds" { + div [ _sseConnect "/gps/sse" ] [] |> shouldRender """
""" + } ] /// Tests for the Script module diff --git a/src/ViewEngine.Htmx/Htmx.fs b/src/ViewEngine.Htmx/Htmx.fs index 1d8f34a..97ede77 100644 --- a/src/ViewEngine.Htmx/Htmx.fs +++ b/src/ViewEngine.Htmx/Htmx.fs @@ -317,6 +317,7 @@ module HxVals = /// Create values from a list of key/value pairs let From = toJson + /// Attributes and flags for htmx [] module HtmxAttrs = @@ -438,6 +439,12 @@ module HtmxAttrs = /// Establishes a WebSocket or sends information to one let _hxWs = attr "hx-ws" + /// The name of the message to swap into the DOM. + let _sseSwap = attr "sse-swap" + + /// The URL of the SSE server. + let _sseConnect = attr "sse-connect" + /// Script tags to pull htmx into an web page module Script =