Ratatouille v0.5.1 Ratatouille View Source
Ratatouille is a framework for building terminal UIs.
Link to this section Summary
Functions
Starts an application under a supervised runtime, given a module implementing
the Ratatouille.Application
behaviour. This call blocks until the
application is quit (or it crashes).
Link to this section Functions
Starts an application under a supervised runtime, given a module implementing
the Ratatouille.Application
behaviour. This call blocks until the
application is quit (or it crashes).
This is intended as a way to easily run simple apps and examples. For more
complex apps depending on other processes, it's recommended to define an OTP
application and start the Ratatouille.Runtime.Supervisor
as a child of your
application supervisor.
Example
defmodule Counter do
@behaviour Ratatouille.App
import Ratatouille.View
def init(_context), do: 0
def update(model, msg) do
case msg do
{:event, %{ch: ?+}} -> model + 1
{:event, %{ch: ?-}} -> model - 1
_ -> model
end
end
def render(model) do
view do
label(content: "Counter is #{model} (+/-)")
end
end
end
Ratatouille.run(Counter)