prpc.utils.Signal¶
-
class
prpc.utils.signal.
Signal
¶ Extremely simple ‘pub-sub’ implementation inspired by aiohttp.
Client API is inherited from the built-in list class, to add a listener one can just use append.
Accepts both sync and async callables as listeners.
Example:
signal = Signal() signal.append(sync_listener) signal.append(async_listener) await signal.send("arg")
-
coroutine
send
(*args, **kwargs)¶ Emit the signal passing arbitrary arguments to all subscribers.
-
coroutine