abstract class
Components::StatefulComponent
- Components::StatefulComponent
- Components::Component
- Reference
- Object
Overview
Base class for stateful components These components maintain internal state and can respond to user interactions
Direct Known Subclasses
- Components::Examples::CounterComponent
- Components::Examples::FormComponent
- Components::Reactive::ReactiveComponent
- UI::ViewAdapter
Defined in:
components/base/stateful_component.crConstructors
Instance Method Summary
-
#cacheable? : Bool
Stateful components should not be cached by default
-
#changed? : Bool
Check if component has changed
-
#get_state(key : String) : JSON::Any | Nil
Get a state value
-
#mark_changed!
Mark component as changed
-
#reset_changed
Alias for consistency
-
#reset_changed!
Reset changed flag
-
#set_state(key : String, value : JSON::Any) : Nil
Set a state value
-
#set_state(key : String, value : String)
Set state from various types
- #set_state(key : String, value : Int32)
- #set_state(key : String, value : Int64)
- #set_state(key : String, value : Float32)
- #set_state(key : String, value : Float64)
- #set_state(key : String, value : Bool)
- #set_state(key : String, value : Array(JSON::Any))
- #set_state(key : String, value : Hash(String, JSON::Any))
-
#state : Hash(String, JSON::Any)
Get the current state as a hash
-
#state_to_json : JSON::Any
Convert state to JSON