Skip to content
/ evee Public

Event dispatcher for Python 3.6+ without any external dependencies

License

Notifications You must be signed in to change notification settings

onema/evee

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

evee

Build Status Codacy Badge Codacy Badge Code Climate Scrutinizer Code Quality

Summary


This is a port for Python v3.6+ of the Symfony Event Dispatcher.

This event dispatcher follows a pattern called the "Mediator" pattern.

In software engineering, the mediator pattern defines an object that encapsulates how a set of objects interact. This pattern is considered to be a behavioral pattern due to the way it can alter the program's running behavior.

Install

pip install evee

Usage

Dispatching simple events

from evee import EventDispatcher
from evee import Event

def pre_foo(self, event: Event, event_name: str):
    print("pre_foo was called")

def post_foo(self, event: Event, event_name: str):
    print("post_foo was called")
        
dispatcher = EventDispatcher()
dispatcher.add_listener('pre.foo', pre_foo)
dispatcher.add_listener('post.foo', post_foo)
dispatcher.dispatch('pre.foo')
print('Doo Foo work')
dispatcher.dispatch('post.foo')

About

Event dispatcher for Python 3.6+ without any external dependencies

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages