class Rooibos::Runtime

Runs the Model-View-Update event loop.

Applications need a render loop. You poll events, update state, redraw. Every frame. The boilerplate is tedious and error-prone.

This class handles the loop. You provide the model, view, and update. It handles the rest.

Use it to build applications with predictable state.

Example

Rooibos.run(
  model: { count: 0 }.freeze,
  view: ->(model, tui) { tui.paragraph(text: model[:count].to_s) },
  update: ->(message, model) { message.q? ? [model, Command.exit] : [model, nil] }
)