Use case for returning {:reply, map, socket} in handle_event callback

Hi,
I’m wondering if there a exists a use case for returning {:reply, map, socket} in handle_event callback. Maybe I’ve overseen something in the documentation :thinking:

Reply to a an event from a hook.

https://hexdocs.pm/phoenix_live_view/js-interop.html#client-hooks

For example, in my hook in mounted()


mounted() {
  ...
  // push event to liveview after handle is moved
  this.slider.on("change", (values, handle) => {
    this.pushEvent("scroll_to_time", { mins: values[handle] }, (payload) => {
      this.slider.set(payload.mins);
    });
  });
  ...

and in my liveview:

  def handle_event("scroll_to_time", %{"mins" => mins}, socket) do
    ...
    {:reply, %{mins: mins}, socket}
  end
1 Like

thx, that’s true :slight_smile: