Skip to content

Latest commit

 

History

History
274 lines (206 loc) · 11.4 KB

router.md

File metadata and controls

274 lines (206 loc) · 11.4 KB

router

Modulor router

router~Route

Kind: inner class of router

route.getRouter()

Get router instance

Kind: instance method of Route

route.getPath() ⇒ String

Kind: instance method of Route
Returns: String - Relative path (global path without router base)

route.getParams() ⇒ Object

Kind: instance method of Route
Returns: Object - URL query parameters

route.routeMatches() ⇒ Boolean

Indicates if route matches path

Kind: instance method of Route

route.getGlobalPath() ⇒ String

Kind: instance method of Route
Returns: String - Global path

route.resolve()

Resolves route

Kind: instance method of Route

router~Router

Kind: inner class of router

router.handleRouteChange()

Kind: instance method of Router

router.isRouter($el) ⇒ Boolean

Indicates if element is router node

Kind: instance method of Router

Param Type
$el HTMLElement

router.getChildRouters() ⇒ Array.<HTMLElement>

Kind: instance method of Router
Returns: Array.<HTMLElement> - Child router nodes

router.resolve()

Resolves router

Kind: instance method of Router

router.getRootRouter() ⇒ HTMLElement

Kind: instance method of Router
Returns: HTMLElement - Root router

router.getRoot() ⇒ String

Kind: instance method of Router
Returns: String - Path base

router.getQs() ⇒ String

Kind: instance method of Router
Returns: String - URL query string

router.getParams() ⇒ Object

Kind: instance method of Router
Returns: Object - URL query parameters

router.setParams(queryParams, navigationParams)

Set new query parameters. Leave only provided parameters in query string

Kind: instance method of Router

Param Type Description
queryParams Object URL query parameters
navigationParams NavigationParams Navigation params

router.updateParams(queryParams, navigationParams)

Update query parameters. Overwrite if param exists, add if not

Kind: instance method of Router

Param Type Description
queryParams Object URL query parameters
navigationParams NavigationParams Navigation params

router.useHash() ⇒ Boolean

Indicates if router uses hashbang

Kind: instance method of Router

router.getGlobalPath() ⇒ String

Kind: instance method of Router
Returns: String - Global path

router.getPath() ⇒ String

Kind: instance method of Router
Returns: String - Relative path (global path without router base)

router.rootMatches() ⇒ Boolean

Indicates if router base matches current path

Kind: instance method of Router

router.add(path, callback)

Add route

Kind: instance method of Router

Param Type Description
path String Path
callback function Callback

router.navigate(path, params)

Navigate to path

Kind: instance method of Router

Param Type Description
path String Path relative to router base
params NavigationParams Navigation params

router.getRoutes() ⇒ Array.<Route>

Get routes

Kind: instance method of Router

router.mount(path, router)

Mount another router on subpath of current one

Kind: instance method of Router

Param Type Description
path String Path
router Router Router

router.unmount(router)

Unmount child router

Kind: instance method of Router

Param Type Description
router Router Router

router.destroy()

Destroy router

Kind: instance method of Router

router~NavigationParams : Object

Kind: inner typedef of router
Properties

Name Type Default Description
[absolute] boolean false Use absolute path instead of relative by default
[silent] boolean false Do not resolve routers after navigation
[replace] boolean false Replace history state instead of push
[noLeadingSlash] boolean false Put slash before route to navigate to