import { Misc, Routing, Views } from "@singularsystems/neo-core"; export type RouteChangedLeavePrompt = string | false | Promise | Promise; export interface IRouteChangedProps { /** * True if the user is navigating to a new view or leaving the site. False if navigating to a sub route in this view. */ readonly isNewView: boolean; /** * True if the window is being unloaded. Either by closing the tab, or navigating to an external site. */ readonly isUnload: boolean; /** * The view (if it inherits from ViewBase) currently being rendered. */ readonly currentView?: Views.IViewBase; /** * The route being navigated to. */ readonly newRoute?: Routing.IRoute; /** * The url match information. Url parameter values can be viewed on this object. */ readonly params?: { [index: string]: any; }; /** * A leave prompt to show the user before the location is changed. * If you want to display your own prompt, set this to the promise returned by the modal. * If you want to block navigation (with no option for the user to continue), return false. * Note: if `isUnload` is true, the browser will show a native leave prompt regardless of whether you show a custom prompt. */ leavePrompt?: RouteChangedLeavePrompt; }