class

Phosphor::Cmd

Inherits Reference < Object

Base for one-shot async work returned from Screen#handle.

App#run spawns a fiber for each Cmd it receives and sends the returned Event back on the main channel, re-entering the loop. Concrete async subclasses (e.g. Cmd::Fetch) implement run to perform their work and produce a result event.

Widget-navigation commands (Cmd::MoveUp, Cmd::MoveDown, Cmd::Tick) also inherit from Cmd so that MockWidget#handle_cmd has a single typed parameter. They raise NotImplementedError from run — they are dispatched through handle_cmd, never through the async path.

See DESIGN.md § "Commands (Cmd)" for the full rationale and examples.

Instance methods

run

Performs async work and returns an Event that re-enters the main loop.

Called by App#run in a spawned fiber. The event is sent on the shared Channel(Event) and dispatched like any keyboard or port event on the next iteration.

Source

Nested types