Vibe.Event.Bus (vibe v0.2.1)

Copy Markdown View Source

Registry-backed access point for UI sessions.

Plugins and background workers use this module to update UI state without knowing whether the UI is rendered by the TUI, LiveView, or tests.

Summary

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

dispatch(session_id, command)

@spec dispatch(String.t(), term()) :: :ok | {:error, :not_found}

emit(session_id, type, data \\ %{})

@spec emit(String.t(), atom(), term()) :: :ok | {:error, :not_found}

emit_all(type, data \\ %{}, opts \\ [])

@spec emit_all(atom(), term(), keyword()) :: :ok

notify_all(notification, opts \\ [])

@spec notify_all(
  term(),
  keyword()
) :: :ok

register(session_id, server)

@spec register(String.t(), GenServer.server()) :: :ok

server(session_id)

@spec server(String.t()) :: {:ok, GenServer.server()} | {:error, :not_found}

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

unregister(session_id, server)

@spec unregister(String.t(), GenServer.server()) :: :ok