signal¶
Warning
Tips: This section covers the implementations of JAnim, which may be quite complex. If you do not have the need to delve into the source code, you may choose to read it at your discretion.
- class janim.utils.signal.Signal(func: Callable[Concatenate[T, P], R])¶
Bases:
Generic[T,P,R]- objects_with_slots: WeakSet = set()¶
- self_slot(func=None, /, *, key: str = '')¶
The decorated method will be called when the
Signalis triggered
- self_refresh(func=None, *, key: str = '')¶
The decorated method will be marked as needing to be recalculated when the
Signalis triggered
- self_refresh_with_recurse(*, recurse_up: bool = False, recurse_down: bool = False, key: str = '')¶
被修饰的方法会在
Signal触发时,标记需要重新计算并且会根据
recurse_up和recurse_down进行递归传递
- connect(sender: object, func: Callable, *, key: str = '') None¶
Makes
funccalled when theSignalis triggered
- connect_refresh(sender: object, obj: object, func: Callable | str, *, key: str = '') None¶
Makes
funcmarked as needing to be recalculated when theSignalis triggered
- emit(sender: object, *args, key: str = '', **kwargs)¶