API Documentation¶
Import this module to make event handling a little simpler.
-
class
evenz.events.Args[source]¶ Bases:
tupleExtend this named tuple to provide easy-to-understand arguments for your events.
-
property
sender¶ the originator of the event
-
property
-
class
evenz.events.Event(f: Callable, sender: Any = None)[source]¶ Bases:
objectAn event object wraps a function and notifies a set of handlers when the function is called.
-
__init__(f: Callable, sender: Any = None)[source]¶ - Parameters
f – the function that triggers the event
sender – the sender of the event
-
property
handlers¶ Get the handlers for this function.
- Returns
an iteration of the handlers.
-
-
evenz.events.event(f: Callable) → evenz.events.Event[source]¶ Decorate a function or method to create an
Event.- Parameters
f – the function.
- Returns
the event
See also
If you are decorating a method within a class, you’ll need to use the
observable()class decorator on the class as well.