Module: Milktea::Message

Defined in:
lib/milktea/message.rb

Overview

Message definitions for events in the Milktea framework

Constant Summary collapse

None =

No operation message

Data.define
Exit =

Message to exit the program

Data.define
Tick =

Timer tick message with timestamp

Data.define(:timestamp) do
  def initialize(timestamp: Time.now)
    super
  end
end
KeyPress =

Keyboard event message

Data.define(:key, :value, :ctrl, :alt, :shift) do
  def initialize(key:, value:, ctrl: false, alt: false, shift: false)
    super
  end
end
Batch =

Batch multiple messages

Data.define(:messages) do
  def initialize(messages: [])
    super
  end
end
Reload =

Hot reload message

Data.define
Resize =

Terminal resize message

Data.define(:width, :height) do
  def initialize(width: TTY::Screen.width, height: TTY::Screen.height)
    super
  end
end