page_title.py 322 B

123456789101112
  1. from .. import context, json
  2. def page_title(title: str) -> None:
  3. """Set the page title for the current client.
  4. :param title: page title
  5. """
  6. client = context.get_client()
  7. client.title = title
  8. if client.has_socket_connection:
  9. client.run_javascript(f'document.title = {json.dumps(title)}')