Options
All
  • Public
  • Public/Protected
  • All
Menu

@capitec/omni-router

Index

Type Aliases

Route: { animation?: RouteAnimation; cache?: boolean; isDefault?: boolean; isFallback?: boolean; name: string; path: string; tag?: string; title?: string; guard?: any; load?: any }

A navigable route configuration.

Type declaration

  • Optional animation?: RouteAnimation

    The effect to animate the route into and out of view with, e.g. fade, slide, pop.

  • Optional cache?: boolean

    Indicator if the route template should be cached and reused, or recreated every time the route is navigated to.

  • Optional isDefault?: boolean

    Set to load this route if the base URL of the web app is loaded.

  • Optional isFallback?: boolean

    Set to load this route by if no route is loaded.

  • name: string

    The unique identifier for the route, must be the tag name of the web component if tag is not set.

  • path: string

    The relative URL path for the route to set in the browser navigation bar.

  • Optional tag?: string

    The tag name of the web component to render for this route.

  • Optional title?: string

    The window title to set when the route is loaded.

  • guard?:function
    • guard(): boolean | Promise<boolean>
    • Function to execute to determine if the view is allowed to be loaded.

      Returns boolean | Promise<boolean>

  • load?:function
    • load(): Promise<unknown>
    • Function to execute that lazy loads the web component.

      Returns Promise<unknown>

RouteAnimation: "fade" | "slide" | "pop"

The animation to load a page in with when routing.

RoutedLocation: { hash?: string; host: string; href: string; path?: string; pathParams?: object; port?: number; protocol: string; query?: string; queryParams?: object; route?: Route }

The routed location information.

Type declaration

  • Optional hash?: string

    The URL anchor tag part, e.g. "hello"

  • host: string

    The URL host part, e.g. "localhost"

  • href: string
  • Optional path?: string

    The URL path part, e.g. "/todos/1234"

  • Optional pathParams?: object

    The URL path part as a key value pairs, e.g. { id: 1234 }

  • Optional port?: number

    The URL port part, e.g. 3000

  • protocol: string

    The URL protocol part, e.g. "http"

  • Optional query?: string

    The URL query string part, e.g. "?foo=bar"

  • Optional queryParams?: object

    The URL query string part as a key value pairs, e.g. { foo: "bar" }

  • Optional route?: Route

    The route configuration that matches the location.

RouterEventCallback: ((detail: { current: RoutedLocation; previous?: RoutedLocation }) => void)

Type declaration

RouterEventType: "route-loading" | "route-loaded"

List of events dispatched by the router.

Variables

Router: RouterImpl = ...

Generated using TypeDoc