globals.py 784 B

12345678910111213141516171819202122232425
  1. from __future__ import annotations
  2. import asyncio
  3. import logging
  4. from typing import TYPE_CHECKING, Awaitable, Callable, List, Union
  5. if TYPE_CHECKING:
  6. import justpy as jp
  7. from starlette.applications import Starlette
  8. from .config import Config
  9. from .elements.page import Page
  10. app: 'Starlette'
  11. config: 'Config'
  12. server: 'uvicorn.Server'
  13. page_stack: List['Page'] = []
  14. view_stack: List['jp.HTMLBaseComponent'] = []
  15. tasks: List[asyncio.tasks.Task] = []
  16. log: logging.Logger = logging.getLogger('nicegui')
  17. connect_handlers: List[Union[Callable, Awaitable]] = []
  18. disconnect_handlers: List[Union[Callable, Awaitable]] = []
  19. startup_handlers: List[Union[Callable, Awaitable]] = []
  20. shutdown_handlers: List[Union[Callable, Awaitable]] = []
  21. pre_evaluation_succeeded: bool = False