datadog-ux-utils Documentation - v1.0.0
    Preparing search index...

    Function hookRouter

    • Hooks into SPA route changes and reports navigation timing and largest script chunk size.

      Parameters

      • getRoute: () => string

        Function returning the current route (e.g., pathname).

      Returns () => void

      Unsubscribe function to clean up listeners and intervals.

      import { hookRouter } from './routeTiming';
      const unsubscribe = hookRouter(() => window.location.pathname);
      // ...
      unsubscribe(); // when cleaning up