Browse Source

Allow access to page template head and body

David Kincaid 1 year ago
parent
commit
424c0df804
1 changed files with 6 additions and 3 deletions
  1. 6 3
      nicegui/client.py

+ 6 - 3
nicegui/client.py

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