DataStar
Gleam bindings for 🚀 https://data-star.dev/.
This library provides Gleam functions for building server sent events (SSE) in the backend to use with Datastar.
[
remove_fragments("#error")
|> remove_fragments_end,
merge_fragments("<span>Hello</span>")
|> merge_fragments_selector("#notice")
|> merge_fragments_merge_mode(Inner)
|> merge_fragments_end,
]
|> events_to_string
This generates:
event: datastar-remove-fragments
data: selector #error
event: datastar-merge-fragments
data: mergeMode inner
data: selector #notice
data: fragments <span>Hello</span>
API documentation at https://hexdocs.pm/datastar.
Datastar SSE reference https://data-star.dev/reference/sse_events.
To use this with wisp, see https://hexdocs.pm/datastar_wisp.