API¶
-
class
perceptible.
Observable
¶ Bases:
object
A class meant to be API compatible with a Dictionary, with the addition of the add remove and notify observers
-
add_observer
(observer)¶ Add an observer to this data structure, the observer will be called whenever this instance of this data structure is modified, with this data structure as the only argument.
Parameters: observer (Method) – The method that should be called when this data structure changes.
-
notify_observers
()¶ Call all current observers, and notify them of the current state of this instance of this data structure.
-
remove_observer
(observer)¶ Remove an observer from this instance of this data structure.
Parameters: observer (Method) – The method to remove, so it will no longer be notified
-
-
class
perceptible.
ObservableDictionary
(*args, **kwargs)¶ Bases:
perceptible.observable.Observable
,collections.abc.MutableMapping
A class meant to be API compatible with a Dictionary, with the addition of the add remove and notify observers