Packages

LiveView TimeTravel debugger allows you to record and replay your LiveView's lifecycle as you interact with the page

Current section

Files

Jump to
time_travel lib time_travel.ex
Raw

lib/time_travel.ex

defmodule TimeTravel do
@moduledoc """
Documentation for `TimeTravel`.
"""
defmacro __using__(_) do
quote do
@before_compile TimeTravel
end
end
defmacro __before_compile__(_env) do
quote do
def handle_cast({:time_travel, _socket_id, nil}, socket) do
{:noreply, socket}
end
def handle_cast({:time_travel, socket_id, assigns}, %{id: id} = socket)
when id == socket_id do
{:noreply, assign(socket, assigns)}
end
def handle_cast({:time_travel, _socket_id, _assigns}, params, socket) do
{:noreply, socket}
end
end
end
end