Phoenix.LiveView.send_update_after
You're seeing just the function
send_update_after
, go back to Phoenix.LiveView module for more information.
Link to this function
send_update_after(pid \\ self(), module, assigns, time_in_milliseconds)
View SourceSimilar to send_update/3
but the update will be delayed according to the given time_in_milliseconds
.
Examples
def handle_event("cancel-order", _, socket) do
...
send_update_after(Cart, [id: "cart", status: "cancelled"], 3000)
{:noreply, socket}
end
def handle_event("cancel-order-asynchronously", _, socket) do
...
pid = self()
Task.async(fn ->
# Do something asynchronously
send_update_after(pid, Cart, [id: "cart", status: "cancelled"], 3000)
end)
{:noreply, socket}
end