Aurora.Uix.Action (Aurora UIX v0.1.0)
Represents an action with a name and an associated function component.
Key Features
- Encapsulates an action's name and its function component.
- Provides flexible constructors for different input types.
Key Constraints
- The
:namemust be a binary. - The
:function_componentmust be a function.
Summary
Functions
Retrieves all the available actions group.
Retrieves the available actions for the given group.
Creates a new action from a tuple containing the name and function component.
Creates a new action from a name and a function component.
Types
Functions
@spec action_groups() :: [atom()]
Retrieves all the available actions group.
Returns
A list(atom()) with all the available actions groups.
Retrieves the available actions for the given group.
Parameters
action_group(atom()) - Name of the group to retrieve.
Returns
A map() or nil if the group does not exists.
Creates a new action from a tuple containing the name and function component.
Parameters
{name, function_component}({binary(), function()}) - Tuple with the action name and function.
Returns
Aurora.Uix.Action.t() - An action struct with the given name and function component.
Examples
iex> Aurora.Uix.Action.new({"delete", fn -> :deleted end})
%Aurora.Uix.Action{name: "delete", function_component: #Function<...>}
Creates a new action from a name and a function component.
Parameters
name(atom()) - The name of the action.function_component(function()) - The function component to associate.
Returns
Aurora.Uix.Action.t() - An action struct with the given name and function component.
Examples
iex> Aurora.Uix.Action.new("save", fn -> :ok end)
%Aurora.Uix.Action{name: "save", function_component: #Function<...>}