wijjit.core.events.Handler
- class wijjit.core.events.Handler(callback, scope, event_type=None, view_name=None, element_id=None, priority=0)[source]
Event handler registration.
Encapsulates an event handler callback with its metadata. Supports both synchronous and asynchronous callbacks.
- Parameters:
callback (
Callable[[Event],None] | Callable[[Event],Awaitable[None]]) – Function to call when event is dispatched (sync or async)scope (
HandlerScope) – Scope at which this handler operatesevent_type (
EventTypeorNone) – Type of event to handle (None for all types)view_name (
strorNone) – View name for view-scoped handlerselement_id (
strorNone) – Element ID for element-scoped handlerspriority (
int) – Handler priority (higher = earlier execution)
- Variables:
callback (
Callable[[Event],None] | Callable[[Event],Awaitable[None]]) – Function to call when event is dispatchedscope (
HandlerScope) – Scope at which this handler operatesevent_type (
EventTypeorNone) – Type of event to handle (None for all types)view_name (
strorNone) – View name for view-scoped handlerselement_id (
strorNone) – Element ID for element-scoped handlerspriority (
int) – Handler priority (higher = earlier execution)
- __init__(callback, scope, event_type=None, view_name=None, element_id=None, priority=0)
Methods
__init__(callback, scope[, event_type, ...])Attributes
Check if this handler is async.
- scope: HandlerScope