documentcloud/backbone — Issue #874: Router.initializeRoute
Author: paulmillr
Created: 2012-01-19 08:49:56+00:00
State: open

I want to implement backbone.js authentication. I expected to see function like `initializeRoute` that would allow to write code like this:

```coffeescript
class MainRouter extends Backbone.Router
initializeRoute: ->
# Proceed if user is authenticated
# otherwise redirect to login page.
if app.account.authenticated()
super fragment
else
super 'login'
```

but I didn't found it. Is there any backbone-way to do it? If not, I can submit a pull request for this.