A Module containing a basic Event System
Project description
Installation:
pip install kurumii_events
Usage
from kurumii_events import EventManager
# Create an EventManager instance
manager = EventManager()
# Register an event
manager.register_event("greet")
# Define a callback
def say_hello(name):
print(f"Hello, {name}!")
# Subscribe the callback to the event
manager.subscribe("greet", say_hello)
# Emit the event
manager.emit("greet", name="Alice") # Output: "Hello, Alice!"
# Unsubscribe the callback
manager.unsubscribe("greet", say_hello)
# Decorator usage
@manager.event("greet")
def another_greeting(name):
print(f"Hi, {name}!")
# Emit the event again
manager.emit("greet", name="Bob") # Output: "Hi, Bob!"
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kurumii_events-0.0.3.4.tar.gz.
File metadata
- Download URL: kurumii_events-0.0.3.4.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2634980429e5b3c68492f489f85353af11a0e80a412cc8cc9fd0978a001076b
|
|
| MD5 |
add3444e5aba80cef39f827eeef14daf
|
|
| BLAKE2b-256 |
9972e793377e057355ee397bc5e919e94d6d3ba19d666846e6b623a59179a7da
|
File details
Details for the file kurumii_events-0.0.3.4-py3-none-any.whl.
File metadata
- Download URL: kurumii_events-0.0.3.4-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcb6220e3163b6595864e05db2c2f455c2e9ec6b7ddfaa7eb8b87c1aec3cbad8
|
|
| MD5 |
bd874cba78d975c1cad86cb1e3dc1b3b
|
|
| BLAKE2b-256 |
cc3ac374fa0142381d56e71d7757561a86b974a0e0991d15dc8a04084b722d2e
|