Class GouterLinking<T>

Provides tools to decode and encode urls.

Type Parameters

  • T

Constructors

  • Creates GouterLinking using required routes and create.

    Type Parameters

    Parameters

    • routes: Routes<T>

      map of names to route configurations

    • create: (<N>(name, params, stack?, focusedIndex?) => GouterState<T, N>)

      tool for new states with stack auto-building

        • <N>(name, params, stack?, focusedIndex?): GouterState<T, N>
        • Creates state using required name, params and optional stack. When stack is not passed and routes has appropriate builder, new stack is generated using that builder.

          Type Parameters

          • N extends string | number | symbol

          Parameters

          • name: N

            string to distinguish states

          • params: T[N]

            collection of parameters to customize states

          • Optional stack: GouterState<T, keyof T>[]

            optional list of inner states

          • Optional focusedIndex: number

            optional index of focused state in stack

          Returns GouterState<T, N>

    Returns GouterLinking<T>

Properties

create: (<N>(name, params, stack?, focusedIndex?) => GouterState<T, N>)

tool for new states with stack auto-building used in decodeUrl

Type declaration

    • <N>(name, params, stack?, focusedIndex?): GouterState<T, N>
    • tool for new states with stack auto-building used in decodeUrl

      Type Parameters

      • N extends string | number | symbol

      Parameters

      • name: N
      • params: T[N]
      • Optional stack: GouterState<T, keyof T>[]
      • Optional focusedIndex: number

      Returns GouterState<T, N>

pathRegexpByName: {
    [N in string | number | symbol]?: RegExp
}

Cache to speed up decodePath.

routes: Routes<T>

map of names to route configurations

Methods

  • Creates path parameters from route name and url path string or returns null if no route matched.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • name: N
    • pathStr: string

    Returns null | Partial<T[N]>

  • Creates query parameters from route name and url query string.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • name: N
    • queryStr: string

    Returns Partial<T[N]>

  • Creates url path string from state name and params. Uses = to escape params which equal to next path key and also to represent empty string.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • name: N
    • params: Partial<T[N]>

    Returns string

  • Creates url query string from state name and params. Uses / to represent empty array for params with list: true.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • name: N
    • params: Partial<T[N]>

    Returns string

  • Protected

    Get path regexp for route name.

    Parameters

    • name: keyof T

    Returns RegExp

  • Protected

    Safely encodes a text string as a valid component of a Uniform Resource Identifier (URI).

    Parameters

    • uriComponent: string

    Returns string

Generated using TypeDoc