1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2024-11-18 04:59:03 +00:00
dupeguru/hscommon/docs/notify.rst

27 lines
1.0 KiB
ReStructuredText
Raw Normal View History

2013-06-23 01:32:23 +00:00
==========================================
:mod:`notify` - Simple notification system
==========================================
.. module:: notify
This module is a brain-dead simple notification system involving a :class:`Broadcaster` and a :class:`Listener`. A listener can only listen to one broadcaster. A broadcaster can have multiple listeners. If the listener is connected, whenever the broadcaster calls :meth:`~Broadcaster.notify`, the method with the same name as the broadcasted message is called on the listener.
.. class:: Broadcaster
.. method:: notify(msg)
Notify all connected listeners of ``msg``. That means that each listeners will have their method with the same name as ``msg`` called.
.. class:: Listener(broadcaster)
A listener is initialized with the broadcaster it's going to listen to. Initially, it is not connected.
.. method:: connect()
Connects the listener to its broadcaster.
.. method:: disconnect()
Disconnects the listener from its broadcaster.