API Reference

Events for asyncio

class aioevents.Event(doc: str | None = None)[source]

An event that an object may fire.

Acts as a set for registered events.

Acts as a property descriptor, producing BoundEvent

handler(callable, *, weak: bool = False)

Registers a handler.

If weak is True, keep a weakref to the handler instead of a strong one.

Parameters:
  • callable – Function to call when event is emitted.

  • weak – Should we keep a strong or weak ref?

trigger(*pargs, **kwargs) None

Schedules the calling of all the registered handlers. Exceptions are consumed.

If the loop is not currently running, queues the callbacks to be called after it starts.

__call__(*pargs, **kwargs)

Syntactic sugar for trigger()

class aioevents.BoundEvent(...)[source]

A bound event, produced when Event is used as a property on an instance.

Acts as a set for registered handlers.