🚨 Disclaimer: Routify 3 is currently in Release Candidate stage.

Please be aware that while the documentation is comprehensive, it may contain inaccuracies or errors. The codebase is also subject to changes that could affect functionality. We appreciate your understanding and welcome any feedback or contributions.

api

Classes

Instance

Router Options

instance: RoutifyRuntime (default: GlobalInstance)

Instance to use. Uses global instance by default.

rootNode: RNodeRuntime (default: undefined)

The root node of the router.

routes: any (default: undefined)

The routes tree.

name: string (default: undefined)

Name of the router - leave blank if only one router is used.

urlRewrite: UrlRewrite|UrlRewrite[] (default: undefined)

Hook: transforms paths to and from the router and browser.

urlReflector: import('../lib/runtime/Router/urlReflectors/ReflectorBase.js')['BaseReflector'] (default: Browser)

Where to store the URL state - browser by default.

url: string (default: '/')

Initial URL - "/" by default.

passthrough: Boolean|Router (default: false)

Ignore clicks.

beforeRouterInit: MaybeArray<RouterInitCallback> (default: undefined)

Hook: runs before each router initiation.

afterRouterInit: MaybeArray<RouterInitCallback> (default: undefined)

Hook: runs after each router initiation.

beforeUrlChange: MaybeArray<BeforeUrlChangeCallback> (default: undefined)

Hook: guard that runs before URL changes.

afterUrlChange: MaybeArray<AfterUrlChangeCallback> (default: undefined)

Hook: runs after URL has changed.

afterRouteRendered: MaybeArray<AfterRouteRenderedCallback> (default: undefined)

Hook: runs after a new route has been rendered.

transformFragments: MaybeArray<TransformFragmentsCallback> (default: undefined)

Hook: transform route fragments after navigation.

onMount: MaybeArray<OnMountRouterCallback> (default: undefined)

Hook: runs when the router is mounted.

onDestroy: MaybeArray<OnDestroyRouterCallback> (default: undefined)

Hook: runs before the router is destroyed.

queryHandler: QueryHandler (default: undefined)

Handles query parameter serialization and parsing.

plugins: Partial<RoutifyRuntimeOptions>[] (default: [])

Plugins to extend or modify functionality.

clickHandler: ClickHandler (default: undefined)

Handles click events for routing.

anchor: AnchorLocation (default: undefined)

Where to place the anchor element.