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.2.tar.gz (1.6 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.2-py3-none-any.whl (1.5 kB view details)

Uploaded Python 3

File details

Details for the file kurumii_events-0.0.3.2.tar.gz.

File metadata

  • Download URL: kurumii_events-0.0.3.2.tar.gz
  • Upload date:
  • Size: 1.6 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.2.tar.gz
Algorithm Hash digest
SHA256 5b84da9da153c250ca9f155ffe0dc550256b9c6db1435035b02a6030f9aa15c4
MD5 2de7e848b14cca5f1c4f1cc2f05cf513
BLAKE2b-256 df70ca916ee556c14b9a2a058d4750bec1489e3c0904863a60e0aaf4f5c8ebfd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kurumii_events-0.0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a4ee958ceee75973f62e76f92b2a531e8bfad9ae2d38d5fba9f8823ad6fad6f0
MD5 b4a442071552e590906fb55ae7333790
BLAKE2b-256 02590ab92b7da86edba2b076f32e3181b5b1edb57b01844172f3fad7ff8c5f4c

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