Dala.Screen.Manager (dala v0.1.0)

Copy Markdown View Source

Central registry for tracking all active screens in the application.

Screens auto-register when started and can be queried by id, name, or pid.

Summary

Functions

Returns a specification to start this module under a supervisor.

Sends a message to a screen identified by identifier (id, name, or pid).

Lists all registered screens as a list of maps with :id, :name, :pid, :module.

Generates a unique screen ID.

Registers a screen with the registry.

Starts the screen manager (supervision child spec).

Unregisters a screen by its PID (called when screen stops).

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

dispatch(identifier, message)

Sends a message to a screen identified by identifier (id, name, or pid).

Returns :ok if sent, {:error, :not_found} if identifier doesn't match any screen.

list()

Lists all registered screens as a list of maps with :id, :name, :pid, :module.

next_id()

Generates a unique screen ID.

register(id, name, pid, module)

Registers a screen with the registry.

  • id: auto-generated unique integer ID
  • name: optional screen name (atom or nil)
  • pid: screen process PID
  • module: screen module (e.g., MyApp.HomeScreen)

start_link(opts)

Starts the screen manager (supervision child spec).

unregister(pid)

Unregisters a screen by its PID (called when screen stops).