OctaStar. Signals
(octa_star v0.1.0)
Copy Markdown
Datastar signal reading and datastar-patch-signals helpers.
Summary
Functions
Formats a signal patch without writing to a connection.
Formats a raw JSON signal patch without writing to a connection.
Formats a signal removal without writing to a connection.
Sends a signal patch from a map.
Sends a signal patch from a JSON string.
Reads Datastar signals from a Plug connection.
Reads Datastar signals and raises on errors.
Removes one or more signals by setting dot-notated paths to null.
Functions
Formats a signal patch without writing to a connection.
Formats a raw JSON signal patch without writing to a connection.
Formats a signal removal without writing to a connection.
@spec patch(Plug.Conn.t(), map(), keyword()) :: Plug.Conn.t()
Sends a signal patch from a map.
@spec patch_raw(Plug.Conn.t(), String.t(), keyword()) :: Plug.Conn.t()
Sends a signal patch from a JSON string.
@spec read(Plug.Conn.t()) :: {:ok, map()} | {:error, term()}
Reads Datastar signals from a Plug connection.
GET and DELETE requests read the datastar query parameter. Other
methods read JSON from the request body unless a parser has already populated
conn.body_params.
@spec read!(Plug.Conn.t()) :: map()
Reads Datastar signals and raises on errors.
@spec remove_signals(Plug.Conn.t(), String.t() | [String.t()], keyword()) :: Plug.Conn.t()
Removes one or more signals by setting dot-notated paths to null.