wijjit.core.view_router.ViewConfig

class wijjit.core.view_router.ViewConfig(name, template='', template_file='', data=None, on_enter=None, on_exit=None, is_default=False, view_func=None, initialized=False, is_async=False, hooks_from_decorator=<factory>)[source]

Configuration for a view.

Supports both synchronous and asynchronous view functions and lifecycle hooks.

Parameters:
  • name (str) – Unique name for this view

  • template (str) – Template string (inline template content)

  • template_file (str) – Template filename to load from template_dir

  • data (Callable[..., dict[str, Any]] or None) – Function that returns data dict for template rendering

  • on_enter (Callable[[], None] | Callable[[], Awaitable[None]] or None) – Hook called when navigating to this view (sync or async)

  • on_exit (Callable[[], None] | Callable[[], Awaitable[None]] or None) – Hook called when navigating away from this view (sync or async)

  • is_default (bool) – Whether this is the default view (shown on startup)

  • view_func (Callable | Callable[..., Awaitable] or None) – The original view function (used for lazy initialization, sync or async)

  • initialized (bool) – Whether this view has been initialized

  • is_async (bool)

  • hooks_from_decorator (dict[str, bool])

Variables:
  • name (str) – Unique name for this view

  • template (str) – Template string (inline template content)

  • template_file (str) – Template filename to load from template_dir

  • data (Callable[..., dict[str, Any]] or None) – Function that returns data dict for template rendering

  • on_enter (Callable[[], None] | Callable[[], Awaitable[None]] or None) – Hook called when navigating to this view (sync or async)

  • on_exit (Callable[[], None] | Callable[[], Awaitable[None]] or None) – Hook called when navigating away from this view (sync or async)

  • is_default (bool) – Whether this is the default view

  • view_func (Callable | Callable[..., Awaitable] or None) – The original view function (for lazy initialization, sync or async)

  • initialized (bool) – Whether this view has been initialized

__init__(name, template='', template_file='', data=None, on_enter=None, on_exit=None, is_default=False, view_func=None, initialized=False, is_async=False, hooks_from_decorator=<factory>)
Parameters:
Return type:

None

Methods

__init__(name[, template, template_file, ...])

Attributes

data

initialized

is_async

is_default

on_enter

on_exit

template

template_file

view_func

name

hooks_from_decorator

name: str
template: str = ''
template_file: str = ''
data: Callable[[...], dict[str, Any]] | None = None
on_enter: Callable[[], None] | Callable[[], Awaitable[None]] | None = None
on_exit: Callable[[], None] | Callable[[], Awaitable[None]] | None = None
is_default: bool = False
view_func: Callable[[...], Any] | Callable[[...], Awaitable[Any]] | None = None
initialized: bool = False
is_async: bool = False
hooks_from_decorator: dict[str, bool]