defmodule PhoenixLiveState do @moduledoc """ Use this module to integrate PhoenixLiveState with your liveviews. """ @moduledoc since: "0.1.0" def state(opts) do quote do use PhoenixLiveState.StateSpec, unquote(opts) end end def client(opts) do live_state_configured? = opts[:live_state] != nil if live_state_configured? do quote do use PhoenixLiveState.LiveView.Hooks, unquote(opts) import PhoenixLiveState.LiveView.Integration end else quote do end end end defmacro __using__(which) when is_atom(which) do apply(__MODULE__, which, [[]]) end defmacro __using__([{which, opts}]) do apply(__MODULE__, which, [opts]) end end