page_title.py 448 B

1234567891011121314151617
  1. from .. import core, json
  2. from ..context import context
  3. def page_title(title: str) -> None:
  4. """Page title
  5. Set the page title for the current client.
  6. :param title: page title
  7. """
  8. client = context.client
  9. client.title = title
  10. if core.app.native.main_window:
  11. core.app.native.main_window.set_title(title)
  12. if client.has_socket_connection:
  13. client.run_javascript(f'document.title = {json.dumps(title)}')