Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tombulled/event

Event handling
https://github.com/tombulled/event

Last synced: 23 days ago
JSON representation

Event handling

Awesome Lists containing this project

README

        

# event
Event handling

## Usage

### Basic
```python
import event

@event.on("alert")
def on_alert():
print("Alert!")
```

```python
>>> event.dispatch("alert")
Alert!
```

### Standard
```python
import event

handler = event.Handler()

@handler.on("login")
def on_login(username: str):
print(f"Logged in as {username}")
```

```python
>>> handler.dispatch("login", username="admin")
Logged in as admin
```