Mob.Nav.Registry (mob v0.3.5)

Copy Markdown View Source

ETS-backed registry mapping screen name atoms to their modules.

Populated at startup by walking an Mob.App module's navigation/1 declarations for both platforms. Hot-code-reload safe — the mapping stores module atoms, not captured references.

register/2 is available for runtime additions: A/B testing, library screens, or dynamic feature flags.

Summary

Functions

Returns a specification to start this module under a supervisor.

Look up the module registered under name.

Register a name → module mapping at runtime.

Start the registry, seeding it from the given App module.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

lookup(name)

@spec lookup(atom()) :: {:ok, module()} | {:error, :not_found}

Look up the module registered under name.

Returns {:ok, module} or {:error, :not_found}.

register(name, module)

@spec register(atom(), module()) :: :ok

Register a name → module mapping at runtime.

Overwrites any existing entry for name.

start_link(app_module)

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

Start the registry, seeding it from the given App module.

Normally started by Mob.Nav.Registry.start_link/1 in your application supervisor. In tests, start it directly.