View Source Termite.Terminal.Adapter behaviour (Termite v0.4.5)

The behaviour module for implementing an adapter.

Summary

Callbacks

Return a reference for the reader for handling input messages.

Returns a map of the width and height

Start the terminal adapter.

Stop the adapter synchronously and release its resources.

Write a string to the terminal. This function is expected to be implemented synchronously in the adapter.

Callbacks

@callback reader(terminal :: term()) :: {:ok, reference()} | {:error, atom()}

Return a reference for the reader for handling input messages.

@callback resize(terminal :: term()) :: %{width: integer(), height: integer()}

Returns a map of the width and height

@callback start(opts :: %{}) :: {:ok, term()} | {:error, atom()}

Start the terminal adapter.

Link to this callback

stop(terminal)

View Source (optional)
@callback stop(terminal :: term()) :: :ok

Stop the adapter synchronously and release its resources.

This callback is optional. Adapters wrapping a shared I/O device should leave that device running.

@callback write(terminal :: term(), string :: String.t()) ::
  {:ok, term()} | {:error, atom()}

Write a string to the terminal. This function is expected to be implemented synchronously in the adapter.