View Source Phoenix.LiveEditableComponent (Phoenix.LiveEditable v0.0.1-alpha.2)

Support for LiveEditable Component Event Handlers

defmodule MyEditableHandler do
  use Phoenix.LiveEditable.Component

  # --- DO NOT DEFINE LIFECYCLE CALLBACKS!!! (mount, update, render)
  # --- DO NOT DEFINE VIEW HELPERS!!!

  # --- on_mount (OPTIONAL) ---

  def on_mount(assigns) do
    # override the default assigns ...
    {:ok, new_assigns}
  end

  # --- event handlers ---

  def handle_event("focus", %{"id" => id}, socket) do
    new_socket = assign(socket, :focusid, id)
    {:noreply, new_socket}
  end

end

Link to this section Summary

Link to this section Functions