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.4.tar.gz
(3.0 kB
view details)
Built Distribution
File details
Details for the file events-system-0.0.4.tar.gz
.
File metadata
- Download URL: events-system-0.0.4.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe052ff623c38e23a78f58afbfab88c4489226cbd086f2909a2046645eb81b48 |
|
MD5 | 4e584a5908dff02a73ecb03d9550107e |
|
BLAKE2b-256 | 0621507b3eca3ba286c0d86ffb2f64f3758fa36112888a6a6de075caf0a56ee5 |
File details
Details for the file events_system-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: events_system-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67ca7e697b3b5ae1ceb3d53d0cfbf38809502aaeed5d881a56c1a328ec9316aa |
|
MD5 | ce0ee061a8e9a007e055a03dd53ac6ce |
|
BLAKE2b-256 | 67b217fc567f1b477a7b528e7307de4e793f60db8fdb5970042edcf7413d7047 |