Signals¶
- class disseminate.signals.signals.Namespace¶
Bases:
dict
A mapping of signal names to signals.
- signal(name, doc=None)¶
Return a signal with the given name.
- Parameters
- namestr
The name of the signal
- docOptional[str]
The description documentation for the signal.
- class disseminate.signals.signals.Signal(name, doc=None)¶
Bases:
object
A notification emitter.
(Inspired by blinker)
- Attributes
- receiversDict[int, Callable]
A dict with the order (key) for a receiver (value) to run when the signal is emitted.
- connect(receiver, order, weak=True)¶
Connect a receiver to this signal.
- Parameters
- receiverCallable
A function that will be executed when this signal is emitted.
- orderint
The order for this receiver to be run.
- weakOptional[bool]
If true, a weak reference will be stored for the receiver.
- connect_via(order, weak=True)¶
The decorator for connect
- emit(**kwargs)¶
Emit (send) the signal and run the receiver functions.
- receivers_dict()¶
Return a dict of receivers (values) and their orders (keys).
- reset()¶
Reset the signal to its initial state