Shared helper functions for PhoenixDatastar modules.
Summary
Functions
Extracts the session map from a Plug.Conn.
Extracts the view module name (last part of module path).
Internal assigns that should be filtered from signals.
Renders a view's template.
Filters internal assigns from a map, returning only user-defined signals.
Functions
@spec get_session_map(Plug.Conn.t()) :: map()
Extracts the session map from a Plug.Conn.
Returns the session data if available, otherwise an empty map.
Extracts the view module name (last part of module path).
Examples
iex> PhoenixDatastar.Helpers.get_view_name(MyApp.CounterStar)
"CounterStar"
@spec internal_assigns() :: [atom()]
Internal assigns that should be filtered from signals.
@spec render_html(module(), PhoenixDatastar.Socket.t()) :: Phoenix.HTML.Safe.t()
Renders a view's template.
Filters internal assigns from a map, returning only user-defined signals.