Interface RouterContext<T, R, C>

Describes a context of the router specific for each resolution.

interface RouterContext<T, R, C> {
    toLocaleString(locales?: string | string[], options?: NumberFormatOptions): string;
    toLocaleString(): string;
    toLocaleString(locales: string | string[], options?: NumberFormatOptions): string;
    toLocaleString(locales: string | string[], options?: NumberFormatOptions & DateTimeFormatOptions): string;
    toString(): string;
    toString(radix?: number): string;
    valueOf():
        | string
        | number
        | boolean
        | Object
        | BigInt64Array
        | BigUint64Array;
    branch: readonly Route<T, R, C>[];
    result: URLPatternResult;
    router: Router<T, R, C>;
    url: URL;
    next(): Promise<undefined | null | T>;
}

Type Parameters

Properties

branch: readonly Route<T, R, C>[]

A sequence of routes connecting the root route to the resolved leaf route. The root route comes first, and the leaf route comes last.

result: URLPatternResult

The result of the current resolution. It is an object returned by the URLPattern#exec method.

router: Router<T, R, C>

The router instance.

url: URL

The URL being resolved.

Methods

  • Converts a number to a string by using the current or specified locale.

    Parameters

    • Optionallocales: string | string[]

      A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.

    • Optionaloptions: NumberFormatOptions

      An object that contains one or more properties that specify comparison options.

    Returns string

  • Returns a date converted to a string using the current locale.

    Returns string

  • Parameters

    • locales: string | string[]
    • Optionaloptions: NumberFormatOptions

    Returns string

  • Parameters

    • locales: string | string[]
    • Optionaloptions: NumberFormatOptions & DateTimeFormatOptions

    Returns string

  • Returns a string representation of a string.

    Returns string

  • Returns a string representation of an object.

    Parameters

    • Optionalradix: number

      Specifies a radix for converting numeric values to strings. This value is only used for numbers.

    Returns string

  • Returns the primitive value of the specified object.

    Returns
        | string
        | number
        | boolean
        | Object
        | BigInt64Array
        | BigUint64Array

  • The method that will execute the action of the next route in the resolution chain.

    Returns Promise<undefined | null | T>

    Note that next can only be called once. Calling it multiple times will produce undefined behavior.