EventRouter

EventRouter

EventRouter holds and manages array of event routes. Event Routes are used by ViewNavigator to find associated View and Viewstack

Viewnavigator find View and ViewStack based on Routes info set in EventRouter Object see Example

Constructor

new EventRouter(_routesopt)

Source:
Example
Sample Event Router Object is in "SimpleNavigator" class (subclass of ViewNavigator) 
     
        initEventRoutes() {
            let evtRoutes = [

               { navEvent: " Login_NavEvent ", viewstackId: “LoginStack", viewId: “loginView", path: "/login" },
               { navEvent: " Register_NavEvent ", viewstackId: “LoginStack", viewId: “registerView", path: "/login" },
               { navEvent: " ForgotPwd_NavEvent", viewstackId: “LoginStack", viewId: “forgotpwdView", path: "/login" }

            ]
            this.eventRouter = new EventRouter(evtRoutes);
        }

        Here "navEvent" is Event Name, "viewstackId" is ViewStack Id, "viewId" is ViewId and "path" is routeID by which ViewNavigator associated.
Parameters:
Name Type Attributes Default Description
_routes array <optional>
[]

Events routes array

Classes

EventRouter

Methods

addRoute(_navEvent, _viewstackId, _viewId, _path)

Source:

Adds new Event Route

Parameters:
Name Type Description
_navEvent string

Navigation Event Name

_viewstackId string

ViewStack ID

_viewId string

View ID

_path string

Navigator Route path associted

findRoute(_navEvent) → {Object}

Source:

find Event Route using Naviagtion EventName

Parameters:
Name Type Description
_navEvent string
Returns:

Event Route Object

Type
Object

findViewId(_navEvent, _path) → {string}

Source:

finds associated view by Navigation EventName and Path

Parameters:
Name Type Description
_navEvent string
_path string
Returns:
  • ViewID
Type
string

findViewStackId(_navEvent, _path) → {string}

Source:

finds associated viewstack by Navigation EventName and Path

Parameters:
Name Type Description
_navEvent string
_path string
Returns:
  • ViewStackID
Type
string

printRoutes()

Source:

prints Event Routes

reset()

Source:

Remove and Resets existing event routes