Interface RouteContext<T, R, C>

The context for a Route.action that could be used to access the route-specific data during the resolution process.

interface RouteContext<T, R, C> {
    chain?: ChainItem<T, R, C>[];
    hash?: string;
    next(resume?: boolean, parent?: Route<T, R, C>, prevResult?: ActionResult<RouteContext<T, R, C>>): Promise<ActionResult<RouteContext<T, R, C>>>;
    params: Readonly<Record<string, ParamValue>>;
    pathname: string;
    redirectFrom?: string;
    resolver?: Resolver<T, R, C>;
    result?: T | RouteContext<T, R, C>;
    route: Route<T, R, C>;
    search?: string;
}

Type Parameters

  • T

    The type of the result produced by the route.

  • R extends object = EmptyObject

    The type of additional route-specific data. Defaults to EmptyObject.

  • C extends object = EmptyObject

    The type of additional context-specific data. Defaults to EmptyObject.

Properties

chain?: ChainItem<T, R, C>[]

The sequence of the resolved route items, so said the path from the root route to the current route.

hash?: string

The hash fragment of the URL.

params: Readonly<Record<string, ParamValue>>

The parameters resolved from the current URL.

pathname: string

The current location.

redirectFrom?: string

The URL from which a redirect occurred.

resolver?: Resolver<T, R, C>

The resolver instance.

result?: T | RouteContext<T, R, C>

The result of the route resolution. It could be either a value produced by the Route.action or a new context to continue the resolution process.

route: Route<T, R, C>

The current route.

search?: string

The search query string of the URL.

Methods