Event manager library
Project description
OnAny is a simple yet powerful event manager library, where you can declare listeners and dispatch as much events as needed to them.
How To
To listen and dispatch events is very simple:
from onany import dispatch, listener
@listener("event.name")
def on_event_name(*args, **kwargs):
print("I've been called with {} and {}".format(
args,
kwargs
))
>>> dispatch(
"event.name",
"first_param",
"second_param",
"third_param",
first="param",
second="param",
third="param")
Should I wait all callbacks to end ?
Nope. You can “threadily” dispatch your events so they don’t need to be waited for the main process.
from onany import disthread, listener
@listener("event.name")
def on_event_name():
print("I'm gonna be executed on another thread")
>>> disthread("event.name")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
onany-0.1.3.tar.gz
(2.0 kB
view hashes)