View Source ReflectOS.Kernel.LayoutManager.Registry (reflect_os_kernel v0.10.2)

Used to register one or more ReflectOS.Kernel.LayoutManagers with the system.

If you are building an extension library with a new layout manager type, the layout manager module must be registered with the ReflectOS system. This will ensure that it's available for users to create and configure layout managers via the Console UI application.

The recommended way to accomplish this is to do so by starting a task in the root supervisor of your application.

For example:

defmodule MyReflectOSExtensions.Application do
  @moduledoc false

  use Application

  alias ReflectOS.Kernel.LayoutManager.Registry, as: LayoutManagerRegistry

  @impl true
  def start(_type, _args) do
    children = [
      # Start a task to register ReflectOS extensions
      {Task, fn -> reflect_os_register() end}
    ]

    opts = [strategy: :one_for_one, name: MyReflectOSExtensions.Supervisor]
    Supervisor.start_link(children, opts)
  end

  defp reflect_os_register() do
    LayoutManagerRegistry.register([
      MyReflectOSExtensions.LayoutManagers.MyNewLayoutManager,
    ])
  end
end

Summary

Functions

Returns a specification to start this module under a supervisor.

Retrieves a list of definitions for all registered layout managers.

Retrieves the list of registered layout manager modules.

Registers a module with the LayoutManager registry.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

@spec definitions() :: [ReflectOS.Kernel.LayoutManager.Definition.t()]

Retrieves a list of definitions for all registered layout managers.

@spec list() :: [module()]

Retrieves the list of registered layout manager modules.

@spec register(module() | [module()]) :: :ok

Registers a module with the LayoutManager registry.

Accepts either a single module or a list of modules.