Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Route<Ttarget>

Route implementation

since

1.0.0

Type parameters

  • Ttarget = unknown

Hierarchy

Index

Methods

Static of

  • of<Ttarget>(params: RouteParams<Ttarget>, state?: Partial<RouteState<any>>): Route<Ttarget>
  • Static helper method to create a new instance of Route

    since

    1.0.0

    static

    Type parameters

    • Ttarget = unknown

    Parameters

    • params: RouteParams<Ttarget>

      Route properties

    • state: Partial<RouteState<any>> = {}

      Initial state

    Returns Route<Ttarget>

initialize

  • initialize(parentHistory: unknown, onHistoryChange: OnHistoryChange<any>, pushHomes: (path: string) => void): void
  • Parameters

    • parentHistory: unknown
    • onHistoryChange: OnHistoryChange<any>
    • pushHomes: (path: string) => void
        • (path: string): void
        • Parameters

          • path: string

          Returns void

    Returns void

setState

  • setState(state: Partial<RouteState<any>>): void
  • Merges specified state to current route state

    since

    1.0.0

    Parameters

    • state: Partial<RouteState<any>>

    Returns void

getState

  • getState(): RouteState<any>

toJSON

  • toJSON(): { type: string; match: any; routeData: any; routingState: undefined | object; path: string; routes: Route<unknown>[]; state: RouteState<any> & { view: any } }
  • Simple Object representation of the route

    since

    1.0.0

    Returns { type: string; match: any; routeData: any; routingState: undefined | object; path: string; routes: Route<unknown>[]; state: RouteState<any> & { view: any } }

    • type: string
    • match: any
    • routeData: any
    • routingState: undefined | object
    • path: string
    • routes: Route<unknown>[]
    • state: RouteState<any> & { view: any }

toString

  • toString(): string

setUrl

  • setUrl(url: string): void

clearUrl

  • clearUrl(): void

clearDirty

  • clearDirty(): void

getUrl

  • getUrl(): null | string

getRedirectto

  • getRedirectto(): undefined | string | (() => string)

build

  • build(router: Router<any>): any
  • Builds a route's view. This method is called whenever router is routing into that path. There are some exceptions:

    • going into a tab, which the tab is created before
    • for iOS, goingBack via gesture or headerBar back
    since

    1.0.0

    Parameters

    • router: Router<any>

      Not the root router, the router which the route belongs to.

    Returns any

    view = null - If the route has been built once, the previous view (page) is given. Otherwise it is null. If view is not null, returning the view back makes it singleton.

hasPath

  • hasPath(): boolean

matchPath

  • matchPath(url: string): undefined | null | string | { path: string; url: any; isExact: boolean; params: any }
  • Checks if the specified url match to the route path

    Parameters

    • url: string

    Returns undefined | null | string | { path: string; url: any; isExact: boolean; params: any }

getUrlPath

  • getUrlPath(): string

getPath

  • getPath(): RoutePath

dispose

  • dispose(): void

Constructors

constructor

  • new Route<Ttarget>(__namedParameters: Omit<RouteParams<Ttarget>, "path"> & { path?: null | string | RoutePath }, __namedParameters?: Partial<RouteState<any>>): Route<Ttarget>
  • Type parameters

    • Ttarget = unknown

    Parameters

    • __namedParameters: Omit<RouteParams<Ttarget>, "path"> & { path?: null | string | RoutePath }
    • __namedParameters: Partial<RouteState<any>> = {}

    Returns Route<Ttarget>

Properties

map

map: MapFunction<Route<any>>

Accessors

state

  • get state(): RouteState<any>

routePath

  • get routePath(): string | (() => string)
  • Helper method to return excat path of the component

    since

    1.0.0

    Returns string | (() => string)

Events

routeDidEnter

  • routeDidEnter(route: Route<Ttarget>): void
  • Handles route is matched and displayed

    example
    Route.of({
    routeDidEnter: (router, route) => {
    //...
    }
    })
    emits

    routeDidEnter

    Parameters

    Returns void

routeDidExit

  • routeDidExit(parent: Route<Ttarget>): void
  • Handles that route is removed by router

    example
    Route.of({
    routeDidExit: (router, route) => {
    //...
    }
    })
    since

    1.0.0

    emits

    routeDidExit

    Parameters

    Returns void

Generated using TypeDoc