cmpt_lazy¶
- class janim.utils.cmpt_lazy.Expired¶
Bases:
object
- janim.utils.cmpt_lazy.cmpt_lazy_method(func: T, *, recurse_up: bool = False, recurse_down: bool = False) T¶
- janim.utils.cmpt_lazy.cmpt_lazy_method(func: None = None, *, recurse_up: bool = False, recurse_down: bool = False) Callable[[T], T]
Used to recompute values returned by component methods only when needed, improving performance.
When recomputation is needed,
self.bind.reset_computed_foris used to reset the computed state. Subsequent calls tofuncwill then recompute and return the value.Note: No caching is provided if the component is not bound to an item.
- class janim.utils.cmpt_lazy.CmptSignal(func: Callable[Concatenate[T, P], R])¶
Bases:
Generic[T,P,R]- self_refresh(func: Fn, *, key: str = '') Fn¶
- self_refresh(func: None = None, *, key: str = '') Callable[[Fn], Fn]
The decorated method is marked for recomputation when a
Signalis triggered.