handler
dev_tool.event.app.handler
AppLifecycleHandler
Bases: EventHandler
A handler class for application lifecycle events.
This class manages hooks for different application events and executes them when corresponding events are received.
The constructor for the AppLifecycleHandler class.
Initializes an empty hooks dictionary for storing event callbacks.
Source code in dev_tool/event/app/handler.py
hooks = {}
instance-attribute
handle
A method that handles incoming events by executing registered hooks.
Parameters:
-
event(Event) –The event object to handle.
Source code in dev_tool/event/app/handler.py
register_hook
A method that registers a hook function for a specific event type.
Parameters:
-
event_type(AppEventType) –The application event type to register the hook for.
-
function(Callable) –The callback function to execute when the event occurs.