View Source DevJoy.Scene.Element.Choice (DevJoy v1.0.0)

Choice visually presented as button gives user a possibility to apply an action. It could be a simple menu item as well as an answer for a character question. Returned data may be used to perform a further changes in UI.

Example

choice = Enum.at(menu_or_question.choices, choice_index)
choice.action.()

Summary

Types

Function to call

Content

Choice struct

Types

@type action() :: (-> any())

Function to call

@type content() :: atom() | String.t()

Content

@type t(content) :: %DevJoy.Scene.Element.Choice{action: action(), content: content}

Choice struct

The content could be a String.t/0 or atom/0 depending on use case. Atom values are not translated no matter if gettext_module option is used in scene.