edifice.StateManager

class edifice.StateManager(initial_values=None)[source]

Bases: object

A key value store where changes to values will trigger a rerender.

Components can subscribe to keys in the store. The values are modified by the update method, which will update all provided keys and trigger re-renders for for all subscribed components for those keys.

Parameters

initial_values (Optional[Mapping[str, Any]]) –

Methods

as_dict()

Returns a (shallow) copy of this StateManager as a dictionary.

copy()

Returns a (shallow) copy of this StateManager.

keys()

set(key, value)

subscribe(component, key)

Subscribes a component to the given key.

update(d)

Updates the key value store.