import AppRouter from 'typhonjs-backbone-parse-todos/site/js/router/AppRouter.js'
AppRouter
Provides a basic Backbone.Router
to route between app states: all
, active
& completed
. When a user
navigates between these different filter type states Backbone.history.navigate
is invoked in App.js->selectFilter
to update the navigation history allowing the user to use the back and forward browser controls to navigate the app.
When a filter type is selected it is referenced in the current URL for the web app. If this URL is navigated to and
the user is still logged into the app AppRouter
will set the AppState
accordingly and ManageTodosView
will
appropriately show the Items
for the current user given the filter state set below. If a user is not logged in
App.js
renders the login view and AppRouter
will replace any route matches with no hash tag.
Please note that in App.js->s_INITIALIZE_ROUTES
a default catch all no route callback is specified which handles
unmatched routes.
Constructor Summary
Public Constructor | ||
public |
Creates the routes delegated to the given methods specified. |
Method Summary
Public Methods | ||
public |
active() Handles the |
|
public |
all() Handles the |
|
public |
Handles the |
Inherited Summary
From class Events | ||
public |
bind(): * Delegates to |
|
public |
Tell an object to listen to a particular event on an other object. |
|
public |
listenToOnce(obj: object, name: string, callback: function): Events Just like |
|
public |
Remove a previously-bound callback function from an object. |
|
public |
Bind a callback function to an object. |
|
public |
Just like |
|
public |
stopListening(obj: object, name: string, callback: function): Events Tell an object to stop listening to events. |
|
public |
Trigger callbacks for the given event, or space-delimited list of events. |
|
public |
unbind(): * Delegates to |
From class Router | ||
public |
Stores the routes hash. |
|
public |
Execute a route handler with the provided parameters. |
|
public abstract |
Initialize is an empty function by default. |
|
public |
Simple proxy to |
|
public |
Manually bind a single named route to a callback. |
Public Constructors
public constructor source
Creates the routes delegated to the given methods specified.
Override:
Router#constructorPublic Methods
public active() source
Handles the active
route. If the user is logged in then appState
is set to active
otherwise the route is
replaced in the browser history with no route.
public all() source
Handles the all
route. If the user is logged in then appState
is set to all
otherwise the route is
replaced in the browser history with no route.
public completed() source
Handles the completed
route. If the user is logged in then appState
is set to completed
otherwise the route
is replaced in the browser history with no route.