Home Reference Source Test
public class | source

Router

Extends:

StateHolder → Router

Routing class.

Constructor Summary

Public Constructor
public

constructor(dispatcher: Dispatcher, location: Location)

Creates a new Router instance

Member Summary

Public Members
public
public
public
public
public

routes: *

Method Summary

Public Methods
public

activate(initialURI: String)

Activates the store by hooking up dispatcher and location listeners.

public

Deactivates the store by removing any listeners from dispatcher and location.

public

Returns the registered routes.

public

Handle start, change and navigate actions.

public

Finds the route for the given url.

public

navigate(href: String)

Navigates to the given url.

public

setRoutes(routes: Object)

Register the given routes.

public

Exports route state to props object.

Private Methods
private

prepareRoute(href: Object, props: Object, params: Array, values: Array): Object

Prepares a route object with given data.

Public Constructors

public constructor(dispatcher: Dispatcher, location: Location) source

Creates a new Router instance

Params:

NameTypeAttributeDescription
dispatcher Dispatcher

instance to use

location Location

instance to use

Public Members

public dispatcher: * source

public dispatcherHandler: * source

public location: * source

public locationHandler: * source

public routes: * source

Public Methods

public activate(initialURI: String) source

Activates the store by hooking up dispatcher and location listeners.

Params:

NameTypeAttributeDescription
initialURI String

initial url

public deactivate() source

Deactivates the store by removing any listeners from dispatcher and location.

public getRoutes(): Object source

Returns the registered routes.

Return:

Object

routes

public handleNavigation(href: String) source

Handle start, change and navigate actions.

Params:

NameTypeAttributeDescription
href String

public matchRoute(href: String): Object source

Finds the route for the given url.

Params:

NameTypeAttributeDescription
href String

Return:

Object

route

public navigate(href: String) source

Navigates to the given url.

Params:

NameTypeAttributeDescription
href String

public setRoutes(routes: Object) source

Register the given routes.

Params:

NameTypeAttributeDescription
routes Object

public toProps(): Object source

Exports route state to props object.

Return:

Object

props

Private Methods

private prepareRoute(href: Object, props: Object, params: Array, values: Array): Object source

Prepares a route object with given data.

Params:

NameTypeAttributeDescription
href Object

parsed url

props Object

route properties

params Array

matched parameters

values Array

value for each parameter

Return:

Object

consolidated route object