Guest User

Untitled

a guest
Jun 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. Class('App', {
  2.  
  3. isa : 'Symbie.Application',
  4.  
  5. trait : 'JooseX.Class.Singleton',
  6.  
  7. does : [
  8. 'SymbieX.History',
  9. 'SymbieX.Tracker.GoogleAnalytics'
  10. ],
  11.  
  12. // either directly specify routes here
  13.  
  14. routes : {
  15.  
  16. '/pictures/all/:fromDate/:toDate' : function (context) {
  17.  
  18. }
  19. },
  20.  
  21. // or receive via role
  22.  
  23. does : [ 'App.Router.Pictures', 'App.Router.Users' ]
  24.  
  25. })
  26.  
  27.  
  28.  
  29.  
  30. Role('App.Router.Pictures', {
  31.  
  32. does : 'Symbie.Router',
  33.  
  34. prefix : '/pictures',
  35.  
  36.  
  37.  
  38. routes : {
  39.  
  40. '/all/:fromDate/:toDate' : function (context) {
  41. var fromDate = context.get('fromDate')
  42. },
  43.  
  44.  
  45. '/pictures/:id' : {
  46.  
  47. where : {
  48. id : /\d+/
  49. },
  50.  
  51. use : [ 'Some.Lazy.Dependency' ],
  52.  
  53. to : function (context) {
  54. var id = context.get('id')
  55.  
  56. context.redirectTo('/picture/123').now()
  57.  
  58. this.CONTINUE()
  59. }
  60. }
  61. }
  62.  
  63. })
  64.  
  65.  
  66. // first call - initialization
  67. App({
  68.  
  69. }).run('/initial/route') // default to '/'
  70.  
  71.  
  72. // later in the app:
  73.  
  74. App().dispatch('/pictures/all/01012010/10012010').now()
Add Comment
Please, Sign In to add comment