Procházet zdrojové kódy

Allow access to page template head and body

David Kincaid před 1 rokem
rodič
revize
424c0df804
1 změnil soubory, kde provedl 6 přidání a 3 odebrání
  1. 6 3
      nicegui/client.py

+ 6 - 3
nicegui/client.py

@@ -38,6 +38,12 @@ class Client:
     auto_index_client: Client
     """The client that is used to render the auto-index page."""
 
+    head_html = ''
+    """HTML to be inserted in the <head> of the page template."""
+
+    body_html = ''
+    """HTML to be inserted in the <body> of the page template."""
+
     def __init__(self, page: page, *, shared: bool = False) -> None:
         self.id = str(uuid.uuid4())
         self.created = time.time()
@@ -59,9 +65,6 @@ class Client:
 
         self.waiting_javascript_commands: Dict[str, Any] = {}
 
-        self.head_html = ''
-        self.body_html = ''
-
         self.page = page
 
         self.connect_handlers: List[Union[Callable[..., Any], Awaitable]] = []