Breeze.Server (Breeze v0.4.0)

Copy Markdown View Source

Public server entrypoint for Breeze applications.

Startup Options

start_link/1 and run/1 accept these public startup options:

  • :view - the root view module. Required.
  • :start_opts - keyword options passed to the root view's mount/2. Defaults to [].
  • :theme - a Breeze.Theme, theme map/keyword, or built-in theme atom.
  • :global_keybindings - app-wide keybindings checked before focused event handling.
  • :reload - enables live code reload. Defaults to Application.get_env(:breeze, :reload, false). Pass true to enable reload in dev, or a keyword list for reload options.
  • :inspector - enables inspector support. Defaults to false. Pass true or keyword options such as :toggle_key, :move_key, and remote: false to keep inspection local without starting distributed Erlang. See Breeze.Inspector for the complete feature and option reference.
  • :logger - configures Breeze log capture. Pass :attach to add a handler while preserving existing handlers, :replace to temporarily silence the default handler, a keyword list with :mode and :max_entries, or false to disable capture. Inspector-enabled servers default to :attach; other servers default to false.
  • :alt_screen - enters the terminal alternate screen. Defaults to true.
  • :hide_cursor - hides the terminal cursor while the app runs. Defaults to true.
  • :enhanced_keyboard - enables enhanced keyboard reporting. Defaults to true.
  • :mouse - enables mouse tracking. Defaults to false. Pass true for click mode or keyword options for Termite.Screen.enable_mouse/2.
  • :terminal_opts - options passed to Termite.Terminal.start/1 when Breeze starts the terminal.
  • :terminal - an existing %Termite.Terminal{} to use instead of starting one.
  • :halt_fun - function called when the input router exits. Defaults to System.halt/0 outside IEx and no-op inside IEx. Use fn -> :ok end for embedded or SSH sessions.
  • :render_errors - crash rendering options. Pass view: MyErrorView to override the crash screen view. Defaults to the built-in crash view. Pass keybindings: [...] to configure custom crash screen actions as {key, label, action} tuples. Supported actions are :restart, :stop, and :copy_details. Custom error views receive these assigns: @view, the crashed root view module; @crash, the crash map; @kind, the crash kind; @reason, the exception, exit reason, or thrown value; @stacktrace, the captured stacktrace; and @breeze.keybindings, the configured visible keybindings.

Summary

Types

A public Breeze server startup option.

Functions

Returns a specification to start this module under a supervisor.

Run the Breeze application until it exits.

Start the Breeze application.

Types

option()

@type option() ::
  {:view, module()}
  | {:start_opts, keyword()}
  | {:alt_screen, boolean()}
  | {:hide_cursor, boolean()}
  | {:enhanced_keyboard, boolean()}
  | {:mouse, boolean() | keyword()}
  | {:terminal_opts, keyword()}
  | {:terminal,
     %Termite.Terminal{adapter: term(), reader: term(), size: term()}}
  | {:reload, boolean() | keyword()}
  | {:theme, Breeze.Theme.t() | map() | keyword() | atom()}
  | {:halt_fun, (-> term())}
  | {:global_keybindings, list()}
  | {:inspector, boolean() | keyword()}
  | {:logger, false | :attach | :replace | keyword()}
  | {:render_errors, keyword()}

A public Breeze server startup option.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

run(opts)

@spec run(keyword()) :: :ok | {:error, term()}

Run the Breeze application until it exits.

This is intended for interactive sessions such as IEx. It starts the terminal input router without linking it to the caller, waits for the app to stop, and returns :ok instead of halting the VM.

start_link(opts)

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

Start the Breeze application.

See the module documentation for startup options.