taika.events
– Basic event managment¶
This module offers a simple event manager implemented in the class
taika.events.EventManager
.
-
events
= {'doc-post-read', 'site-post-read'}¶ The events that the event manager can register functions to.
-
class
EventManager
[source]¶ Register functions to events and passes them arguments and keyword arguments when called.
-
call
(self, event, *args, **kwargs)[source]¶ Call all the functions registered to event passing *args and *kwargs.
Parameters: - event : str
The event which be triggered.
Raises: EventNotFound
If the event that is being triggered does not exist.
-
register
(self, event, func)[source]¶ Register a callable func to an event.
Parameters: - event : str
The event to which func will be registered.
- func : callable
A callable that will recieve arguments and keywords arguments when event is triggered.
Returns: - current_id : int
The ID assigned to the function.
Raises: EventNotFound
If the event that is being triggered does not exist.
-