A class that represents a router instance.

This class should rarely be used directly. Instead, use the Router component to create a new router instance.

Constructors

Properties

applyFn: ApplyFn

The apply function for the router instance.

The config for the router instance.

current: RouteResult = ...

The current route for the router instance.

handlers: RouterHandlers

The handlers for the router instance.

id: string

The id of the router instance.

navigating: boolean = ...

Whether the router instance is navigating.

routes: Set<Route> = ...

The routes for the router instance.

Methods

  • Deregister a router instance by removing it from the registry and restoring the original history methods.

    This is called when a router instance is removed from the DOM triggered by the onDestroy lifecycle method of the router instance.

    Parameters

    Returns void

  • Process a state change event from the browser history API.

    This method is called when the browser history API is used to change the current route via the pushState, replaceState, or popState methods.

    The method will evaluate the route for the given path and query, and apply the route to the router instance to ultimately call the applyFn function on the downstream router component to render the new route.

    Parameters

    • url: string
    • Optionalspan: Span

    Returns Promise<void>

    The span to attach traces to. If not provided, a new span will be created.