Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kurumii_events-0.0.3.4.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kurumii_events-0.0.3.4-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

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

Hashes for kurumii_events-0.0.3.4.tar.gz
Algorithm Hash digest
SHA256 d2634980429e5b3c68492f489f85353af11a0e80a412cc8cc9fd0978a001076b
MD5 add3444e5aba80cef39f827eeef14daf
BLAKE2b-256 9972e793377e057355ee397bc5e919e94d6d3ba19d666846e6b623a59179a7da

See more details on using hashes here.

File details

Details for the file kurumii_events-0.0.3.4-py3-none-any.whl.

File metadata

File hashes

Hashes for kurumii_events-0.0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bcb6220e3163b6595864e05db2c2f455c2e9ec6b7ddfaa7eb8b87c1aec3cbad8
MD5 bd874cba78d975c1cad86cb1e3dc1b3b
BLAKE2b-256 cc3ac374fa0142381d56e71d7757561a86b974a0e0991d15dc8a04084b722d2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page