Reference Source
public class | source

Router

Extends:

../node_modules/devapt-core-common/dist/js/base/stateable.js~StateableRouterState → Router

Constructor Summary

Public Constructor
public

constructor(arg_log_context: string): nothing

Create a Router instance.

Member Summary

Public Members
public
Private Members
private

_hasher: *

private

Method Summary

Public Methods
public

add_handler(arg_route: string | RegExp, arg_handler: Function): nothing

Add a route handler.

public

init(arg_home_view_name: string, arg_home_menubar_name: string): nothing

Init router.

public

parse(arg_url: string): nothing

Parse an url and route it.

public

set_hash_if_empty(arg_view_name: string, arg_menubar_name: string): nothing

Update page url with given view and menubar (update only the hash).

Inherited Summary

From class RouterState
public
public
public

display_content(arg_view_name: string, arg_menubar_name: string): Promise

Display the page content with given view and menubar.

public

Clear history.

public

do_action_display_content(arg_view_name: string, arg_menubar_name: string): nothing

Goto the page content with given view (update only the hash).

public

Display history previous content if available.

public

Display history next content if available.

public

do_action_move_history(arg_new_index: *): nothing

Move history current position.

public

do_action_update_history(arg_new_items: array): nothing

Update history.

public

Get name.

public

handle_state_change(arg_previous_state: Immutable.Map, arg_new_state: Immutable.Map): nothing

Handle state changes.

public

load(arg_state: Immutable.Map | undefined): nothing

Load and apply a container component configuration.

public

reduce_action(arg_previous_state: object, arg_action: object): object

Store actions reducer pure function.

public

update_hash(arg_view_name: string, arg_menubar_name: string): nothing

Update page url with given view and menubar (update only the hash).

Public Constructors

public constructor(arg_log_context: string): nothing source

Create a Router instance.

Override:

RouterState#constructor

Params:

NameTypeAttributeDescription
arg_log_context string

context of traces of this instance (optional).

Return:

nothing

Public Members

public is_router: boolean source

Private Members

private _hasher: * source

private _router_engine: * source

Public Methods

public add_handler(arg_route: string | RegExp, arg_handler: Function): nothing source

Add a route handler.

Params:

NameTypeAttributeDescription
arg_route string | RegExp

route.

arg_handler Function

f(args)

Return:

nothing

public init(arg_home_view_name: string, arg_home_menubar_name: string): nothing source

Init router.

Params:

NameTypeAttributeDescription
arg_home_view_name string

Home view name.

arg_home_menubar_name string

Home menubar name.

Return:

nothing

public parse(arg_url: string): nothing source

Parse an url and route it.

Params:

NameTypeAttributeDescription
arg_url string

url to route.

Return:

nothing

public set_hash_if_empty(arg_view_name: string, arg_menubar_name: string): nothing source

Update page url with given view and menubar (update only the hash).

Params:

NameTypeAttributeDescription
arg_view_name string

view name.

arg_menubar_name string

menubar name.

Return:

nothing