Created
July 18, 2011 16:09
-
-
Save gmoeck/1089967 to your computer and use it in GitHub Desktop.
Started State
This file contains hidden or 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
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