UNPKG

nextjs-router-events

Version:

A router events alternative for Next.js 13+ with app directory with the ability to prevent user navigation.

10 lines (9 loc) 376 B
import { type HistoryURL } from './events'; export interface RouteChangeCallbacks { onBeforeRouteChange?: (target: string) => boolean | void; onRouteChangeStart?: (target: string) => void; onRouteChangeComplete?: (target: HistoryURL) => void; } export declare const useRouteChangeEvents: (callbacks: RouteChangeCallbacks) => { allowRouteChange: () => void; };