Skip to content

Instantly share code, notes, and snippets.

@gmoeck
Created July 18, 2011 16:09
Show Gist options
  • Save gmoeck/1089967 to your computer and use it in GitHub Desktop.
Save gmoeck/1089967 to your computer and use it in GitHub Desktop.
Started State
App.StartedState = SC.State.extend({
enterState: function() {
//do some stuff
this.setupRoutes();
},
exitState: function() {
//remove some stuff
},
setupRoutes: function() {
var routes = SC.routes,
loc = window.location;
routes.set('baseURI', App.get('baseURL'));
var routeHandler = SC.Object.create({
applicationSection1: function(route) {
if(route) {
route.isFromRoute = YES;
}
this.invokeLast(function() {
App.statechart.sendEvent('showApplicationSection1', route);
});
},
applicationSection2: function(route) {
if(route) {
route.isFromRoute = YES;
}
App.statechart.sendEvent('showApplicationSection2', route);
},
applicationSection3: function() {
App.statechart.sendEvent('showApplicationSection3');
},
...
});
routes.add('section1', routeHandler, routeHandler.applicationSection1)
.add('section2', routeHandler, routeHandler.applicationSection2)
.add('section3', routeHandler, routeHandler.applicationSection3)
},
...
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment