View Source Rephex.AsyncAction.Base behaviour (rephex v0.1.1)
Summary
Callbacks
After the async action is resolved, this callback will be called.
Before the async action starts, this callback will be called.
Generate failed value. This value will be set to AsyncResult via AsyncResult.failed/2
.
Get initial progress. This value will be set synchronously before the async action starts.
This callback will be implemented by using.
Start async action.
Types
Callbacks
@callback after_resolve( Phoenix.LiveView.Socket.t(), result_path(), {:ok, success_result()} | {:exit, exit_reason()} ) :: Phoenix.LiveView.Socket.t()
After the async action is resolved, this callback will be called.
@callback before_start(Phoenix.LiveView.Socket.t(), result_path(), payload()) :: Phoenix.LiveView.Socket.t()
Before the async action starts, this callback will be called.
@callback generate_failed_value(result_path(), exit_reason()) :: failed_value()
Generate failed value. This value will be set to AsyncResult via AsyncResult.failed/2
.
@callback initial_progress(result_path(), payload()) :: progress()
Get initial progress. This value will be set synchronously before the async action starts.
@callback options() :: %{optional(:throttle) => non_neg_integer()}
This callback will be implemented by using.
@callback start_async( state(), result_path(), payload(), (progress() -> nil) ) :: success_result()
Start async action.