Hooks into SPA route changes and reports navigation timing and largest script chunk size.
Function returning the current route (e.g., pathname).
Unsubscribe function to clean up listeners and intervals.
import { hookRouter } from './routeTiming';const unsubscribe = hookRouter(() => window.location.pathname);// ...unsubscribe(); // when cleaning up Copy
import { hookRouter } from './routeTiming';const unsubscribe = hookRouter(() => window.location.pathname);// ...unsubscribe(); // when cleaning up
Hooks into SPA route changes and reports navigation timing and largest script chunk size.