edifice.StateValue¶
-
class
edifice.StateValue(initial_value)[source]¶ Bases:
objectContainer to store a value and rerender on value change.
A StateValue stores an underlying Python object. Components can subscribe to the StateValue. StateValues are modified by the set method, which will trigger re-renders for all subscribed components.
- Parameters
initial_value (
Any) – the initial value for the StateValue
Methods
set(value)Sets the current value and trigger rerender.
subscribe(component)Subscribes a component to this value’s updates and returns the current value.
Attributes
valueReturns the current value.