Interface RouteContext<R, C>

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

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

Type Parameters

  • R extends object = EmptyObject

    The type of the result produced by the route.

  • C extends object = EmptyObject

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

Properties

chain?: ChainItem<ActionValue, RouteExtension<R, C>, ContextExtension<R, C>>[] & ChainItem<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<ActionValue, RouteExtension<R, C>, ContextExtension<R, C>> & Router<R, C>

The resolver instance.

result?: ActionValue | RouteContext<ActionValue, RouteExtension<R, C>, ContextExtension<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<ActionValue, RouteExtension<R, C>, ContextExtension<R, C>>

The current route.

search?: string

The search query string of the URL.

Methods