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 operates

  • event_type (EventType or None) – Type of event to handle (None for all types)

  • view_name (str or None) – View name for view-scoped handlers

  • element_id (str or None) – Element ID for element-scoped handlers

  • priority (int) – Handler priority (higher = earlier execution)

Variables:
  • callback (Callable[[Event], None] | Callable[[Event], Awaitable[None]]) – Function to call when event is dispatched

  • scope (HandlerScope) – Scope at which this handler operates

  • event_type (EventType or None) – Type of event to handle (None for all types)

  • view_name (str or None) – View name for view-scoped handlers

  • element_id (str or None) – Element ID for element-scoped handlers

  • priority (int) – Handler priority (higher = earlier execution)

__init__(callback, scope, event_type=None, view_name=None, element_id=None, priority=0)
Parameters:
Return type:

None

Methods

__init__(callback, scope[, event_type, ...])

Attributes

element_id

event_type

is_async

Check if this handler is async.

priority

view_name

callback

scope

callback: Callable[[Event], None] | Callable[[Event], Awaitable[None]]
scope: HandlerScope
event_type: EventType | None = None
view_name: str | None = None
element_id: str | None = None
priority: int = 0
property is_async: bool

Check if this handler is async.

Returns:

True if callback is a coroutine function

Return type:

bool