asyncevents/tests/multiple_events_one_handler.py

22 lines
464 B
Python

import asyncio
from asyncevents import on_event, emit
@on_event("test")
@on_event("hello")
async def hello(_, event: str):
print(f"Hello {event!r}!")
async def main():
print("Firing blocking event 'hello'")
await emit("hello")
print("Handlers for event 'hello' have exited")
print("Firing blocking event 'test'")
await emit("test")
print("Handlers for event 'test' have exited")
if __name__ == "__main__":
asyncio.run(main())