A singleton based thread-safe event system which components can use to subscribe and post to other components.
Project description
Event System
- EventSystem
- A singleton based thread-safe event system, which components can use to subscribe and post to other components.
- install:
pip install event-system
- import:
import EventSystem
- import
EventListener
:from event_system.event_listener import EventListener
- subscribe:
EventSystem.subscribe("event_type", function)
- post:
EventSystem.post(event_type)
- example use: Create an abstract class as listener to a concrete component by subclassing
EventListener
and defining an abstract function along the lines ofsetup_ConcreteComponent_listener
. In its abstract function, this component listener must callsuper().setup_event_handlers()
to which the subscription dictionary{"event_type":function}
is passed. Whatever other component needs to be informed about these events, can now implement that component listener and pass their subscription dictionary to the function.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
events-system-0.0.2.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for events_system-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 614296a79a71bb7449ce9beba4c1a24f213d50907b14a1761e69fcad05305649 |
|
MD5 | 63bd87bf2a392461007f4a7faac31999 |
|
BLAKE2b-256 | 33dfc61ae28f05f964214b9ff85a5aa5d28e16169f87bf94b631a0eb3ce6f039 |