lazysignals =========== .. py:module:: lazysignals .. autoapi-nested-parse:: A library that allows you to run effects whenever state changes. It employs dependency discovery and updates are lazy. Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/lazysignals/_signals/index /autoapi/lazysignals/_utils/index Classes ------- .. autoapisummary:: lazysignals.Signal Functions --------- .. autoapisummary:: lazysignals.effect lazysignals.derived Package Contents ---------------- .. py:class:: Signal(value=None) A container to hold a reactive value. .. py:attribute:: _value :value: None .. py:attribute:: _dependents :value: [] .. py:method:: __str__() get a reactive string representation of the contained value .. py:method:: __repr__() get a (nonreactive) string representation of the container .. py:property:: value :getter: gets the current value, registering the current effect as a dependent :setter: sets the current value, notifying all dependent effects if it changed .. py:function:: effect(fn) Run ``fn()`` whenever (relevant) state changes. :param fn: The function to run on state changes. :returns: The return value of ``fn()``. .. tip:: Use as a function decorator. .. py:function:: derived(fn) Define a new signal whose value is computed by ``fn()``. :param fn: A function to compute the value from. :returns: A new ``Signal``. .. tip:: Use as a function decorator.