A singleton based thread-safe event system which components can use to subscribe and post to other components.
Project description
Events System
- EventsSystem
- A singleton based thread-safe event system, which components can use to subscribe and post to other components.
- install:
pip install events-system
- import:
import EventsSystem
- import
EventListener
:from events_system.event_listener import EventListener
- subscribe:
EventsSystem.subscribe("event_type", function)
- post:
EventsSystem.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.3.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for events_system-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e0e98b3ef549d0b3a64f3274db9f34af83eaa07fd243e1c8c0300f1455adc33 |
|
MD5 | a6bb4086413dc0ce0d841e2a2a36ccd2 |
|
BLAKE2b-256 | 183cc4326cfa335c01b32f6cc0125bf78dcbca0d919deb5b35036a1930f72432 |