Created
November 5, 2010 16:23
-
-
Save canonic-epicure/664394 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class('App', { | |
isa : 'Symbie.Application', | |
trait : 'JooseX.Class.Singleton', | |
does : [ | |
'SymbieX.History', | |
'SymbieX.Tracker.GoogleAnalytics' | |
], | |
// either directly specify routes here | |
routes : { | |
'/pictures/all/:fromDate/:toDate' : function (context) { | |
} | |
}, | |
// or receive via role | |
does : [ 'App.Router.Pictures', 'App.Router.Users' ] | |
}) | |
Role('App.Router.Pictures', { | |
does : 'Symbie.Router', | |
prefix : '/pictures', | |
routes : { | |
'/all/:fromDate/:toDate' : function (context) { | |
var fromDate = context.get('fromDate') | |
}, | |
'/pictures/:id' : { | |
where : { | |
id : /\d+/ | |
}, | |
use : [ 'Some.Lazy.Dependency' ], | |
to : function (context) { | |
var id = context.get('id') | |
context.redirectTo('/picture/123').now() | |
this.CONTINUE() | |
} | |
} | |
} | |
}) | |
// first call - initialization | |
App({ | |
}).run('/initial/route') // default to '/' | |
// later in the app: | |
App().dispatch('/pictures/all/01012010/10012010').now() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment