Finds the listeners of a signal module.
This works like protocol consolidation. A resource that listens to signals defines a module
named Ash.Signals.Listeners.<Resource>, which returns its listeners. Listeners are found by
looking for modules with that prefix, among the loaded modules and the .beam files on the
code path. Neither the signal module nor any domain needs to know about them.
The :ash_signals compiler does this once per build, and compiles the result into an
Ash.Signals.Dispatch.<SignalModule> module, so emitting a signal does not search for
listeners. When there is no dispatch module, because the compiler is not used or
ash: [consolidate_signals: false] is set in the project, listeners are searched for each
time a signal is emitted. See Mix.Tasks.Compile.AshSignals.
Summary
Functions
Finds all listeners of the given signal module, ignoring any dispatch module.
Finds all listeners of all signal modules, ignoring any dispatch modules.
Returns the listeners of the given signal, in a deterministic order.
Finds all signal modules, whether or not anything listens to them.
Functions
@spec discover(Ash.Signals.t()) :: [Ash.Resource.SignalListener.t()]
Finds all listeners of the given signal module, ignoring any dispatch module.
@spec discover_all() :: [Ash.Resource.SignalListener.t()]
Finds all listeners of all signal modules, ignoring any dispatch modules.
@spec listeners(Ash.Signals.t(), atom()) :: [Ash.Resource.SignalListener.t()]
Returns the listeners of the given signal, in a deterministic order.
@spec signal_modules() :: [Ash.Signals.t()]
Finds all signal modules, whether or not anything listens to them.
Each signal module defines an empty Ash.Signals.Index.<SignalModule> module for this purpose.