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 Signal is triggered

self_refresh(func=None, *, key: str = '')

The decorated method will be marked as needing to be recalculated when the Signal is triggered

self_refresh_with_recurse(*, recurse_up: bool = False, recurse_down: bool = False, key: str = '')

被修饰的方法会在 Signal 触发时,标记需要重新计算

并且会根据 recurse_uprecurse_down 进行递归传递

connect(sender: object, func: Callable, *, key: str = '') None

Makes func called when the Signal is triggered

connect_refresh(sender: object, obj: object, func: Callable | str, *, key: str = '') None

Makes func marked as needing to be recalculated when the Signal is triggered

emit(sender: object, *args, key: str = '', **kwargs)