EasyPage.Tabber.Tab behaviour (easy_page v0.1.0)
In order to gain the functionality of tab callbacks, you will need modules that implement the tab lifecycle functions. This may or may not be the Component module.
defmodule TabA do
@behaviour EasyPage.Tabber.Tab
@impl true
def on_init(socket) do
IO.puts "Initialized Tab A"
socket
end
@impl true
def on_first_enter(socket) do
data = call_database()
assign(socket, :data, data)
end
end
Summary
Callbacks
Called EVERY time a tab is selected
Called when the tab is unselected.
Called ONLY the first time a tab is selected
Called for all tabs during Mount
Called every time a tab is selected, except the first time
Callbacks
@callback on_enter(%Phoenix.LiveView.Socket{ assigns: term(), endpoint: term(), fingerprints: term(), host_uri: term(), id: term(), parent_pid: term(), private: term(), redirected: term(), root_pid: term(), router: term(), transport_pid: term(), view: term() }) :: %Phoenix.LiveView.Socket{ assigns: term(), endpoint: term(), fingerprints: term(), host_uri: term(), id: term(), parent_pid: term(), private: term(), redirected: term(), root_pid: term(), router: term(), transport_pid: term(), view: term() }
Called EVERY time a tab is selected
@callback on_exit(%Phoenix.LiveView.Socket{ assigns: term(), endpoint: term(), fingerprints: term(), host_uri: term(), id: term(), parent_pid: term(), private: term(), redirected: term(), root_pid: term(), router: term(), transport_pid: term(), view: term() }) :: %Phoenix.LiveView.Socket{ assigns: term(), endpoint: term(), fingerprints: term(), host_uri: term(), id: term(), parent_pid: term(), private: term(), redirected: term(), root_pid: term(), router: term(), transport_pid: term(), view: term() }
Called when the tab is unselected.
@callback on_first_enter(%Phoenix.LiveView.Socket{ assigns: term(), endpoint: term(), fingerprints: term(), host_uri: term(), id: term(), parent_pid: term(), private: term(), redirected: term(), root_pid: term(), router: term(), transport_pid: term(), view: term() }) :: %Phoenix.LiveView.Socket{ assigns: term(), endpoint: term(), fingerprints: term(), host_uri: term(), id: term(), parent_pid: term(), private: term(), redirected: term(), root_pid: term(), router: term(), transport_pid: term(), view: term() }
Called ONLY the first time a tab is selected
@callback on_init(%Phoenix.LiveView.Socket{ assigns: term(), endpoint: term(), fingerprints: term(), host_uri: term(), id: term(), parent_pid: term(), private: term(), redirected: term(), root_pid: term(), router: term(), transport_pid: term(), view: term() }) :: %Phoenix.LiveView.Socket{ assigns: term(), endpoint: term(), fingerprints: term(), host_uri: term(), id: term(), parent_pid: term(), private: term(), redirected: term(), root_pid: term(), router: term(), transport_pid: term(), view: term() }
Called for all tabs during Mount
@callback on_not_first_enter(%Phoenix.LiveView.Socket{ assigns: term(), endpoint: term(), fingerprints: term(), host_uri: term(), id: term(), parent_pid: term(), private: term(), redirected: term(), root_pid: term(), router: term(), transport_pid: term(), view: term() }) :: %Phoenix.LiveView.Socket{ assigns: term(), endpoint: term(), fingerprints: term(), host_uri: term(), id: term(), parent_pid: term(), private: term(), redirected: term(), root_pid: term(), router: term(), transport_pid: term(), view: term() }
Called every time a tab is selected, except the first time