code: def register_pages_changed_callback(
      callback: Callable[[str], None],
  ):
      def disconnect():
          _on_pages_changed.disconnect(callback)
  
      # weak=False so that we have control of when the pages changed
      # callback is deregistered.
      _on_pages_changed.connect(callback, weak=False)
  
      return disconnect
  
file_path: streamlit/lib/streamlit/source_util.py
imports: import re
  import threading
  from pathlib import Path
  from typing import Any, Callable, Dict, Optional, Tuple, cast
  from blinker import Signal
  from streamlit.logger import get_logger
  from streamlit.string_util import extract_leading_emoji
  from streamlit.util import calc_md5
label_desc: Use image node_id 6 for calling a global function with example usage: register_pages_changed_callback(callback) and returns: disconnect