Skip to main content

Simple Event handler with custom objects for tracking realtime data changes

Project description

SimpleEvents

Simple Event Handler and utility objects for monitoring and responding to changes in data structures.

Changelog

0.1.0 Initial Release

  • Implemented generic Event() object for event processing
  • Implemented EventList(). Custom list with events to respond to adding, removal, and change of entries. And responding to clearing of List.

Installation

pip install eventables

Event() Usage

from eventables.events import Event

class MyObject:
    def __init__(self):
        self.my_event = Event()
    
    def trigger_example(self):
        # do stuff
        self.my_event(my_arg="Successful Event Call")
        
def reaction_function(my_arg):
    print(my_arg)

def demo():
    my_object = MyObject()
    my_object.my_event += reaction_function
    my_object.trigger_example()

Output

>>> demo()
Successful Event Call

EventList() Usage

List

from eventables.events import EventList

class MyObject:
    def __init__(self):
        self.my_list = EventList()
        
def reaction_function(value):
    print(f"Successfully added {value} to list!")

def demo():
    my_object = MyObject()
    my_object.my_list.on_entry_added += reaction_function
    my_object.my_list.append("Test Object")

Output

>>> demo()
Successfully added Test Object to list!

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

eventables-0.1.0.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

eventables-0.1.0-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

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