-
Notifications
You must be signed in to change notification settings - Fork 288
Router
Daryl Hedley edited this page Jun 2, 2014
·
5 revisions
The router in Origin has been built to be extendable through an events based system. The router has just two routes:
"": "handleIndex",
":module(/*location)(/*subLocation)(/*action)": "handleRoute"
handleIndex
will check authentication and load the dashboard if authenticated. If not - then the login screen is loaded.
handleRoute
will take in the module, location, subLocation and action
- clears up the views, updates Origin.location object and triggers two events:
-
('location:change', [Origin.location])
- Passes out the Origin.location object -
('router:' + module, [location, subLocation, action])
- Triggers a router event based upon the module argument from a route. Passes out location, subLocation and action.