A simple events handler package.
Project description
Dyspatch
A simple package that implements basic events handling in Python.
Installation
pip install dyspatch
Usage
A basic example is as follows:
import dyspatch
users = []
def on_room_join(user):
print(f'{user} joined the room.')
users.append(user)
print(f'We now have {len(users)} users')
events = dyspatch.Events()
events.add_listener('room_join', on_room_join)
events.dispatch('room_join', args=['Alex'])
events.dispatch('room_join', args=['Bob'])
The output is like this:
Alex joined the room.
We now have 1 users
Bob joined the room.
We now have 2 users
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.