Tailwind.Phoenix.Index (Phoenix Tailwind Notifications v0.1.3) View Source

Helper to make useful notifications to be used in LiveView index.ex files.

It implements handle_info/2 LiveView callbacks for events, updates the current assigns if a notification arrives.

The value function gets passed the socket as first and only parameter. This way you can use any assign in the socket to use the correct query.

Examples

defmodule MyWeb.MyDataLive.Index do
  use MyWeb, :live_view

  use Tailwind.Phoenix.Index,
    notifier: MyWeb.Notifier,
    key: :datas,
    data: %My.MyData{},
    value: &list_datas/1,
    to: &Routes.my_data_path(&1, :index)

  ...
end

Link to this section Summary

Functions

When used, implements handle_info/2 for index.ex.

Link to this section Functions

Link to this macro

__using__(opts)

View Source (macro)

When used, implements handle_info/2 for index.ex.