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.3.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.3-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kurumii_events-0.0.3.3.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.3.tar.gz
Algorithm Hash digest
SHA256 0ee4d4e00b05ce56bfd4ffe136fc36b8ee3683cd7d994976e8199a4ec74db40f
MD5 67221f4ce573f2df880e82215c7c772a
BLAKE2b-256 45a669c95ee7c8e228d15b1fc0240bb79bd5467c2ae3c6373961cf721d5f0aeb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kurumii_events-0.0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 646b3d9af9a4fc73c8ea6233510d0ffadbcdaab1aa168e1f4bdfbc04b8cc36aa
MD5 e21991ffed7ddad6f08993f847e799c3
BLAKE2b-256 a64c70d5d61dc52618201c62460fb6306ea61fc4897f655f20fa084b16f01161

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