Last active
August 29, 2015 14:15
-
-
Save samandmoore/a59d4be4fd59884135ac to your computer and use it in GitHub Desktop.
beforeRender
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
BaseRouter.extend({ | |
'portfolio': new PortfolioRoute(), | |
// or the old way... | |
'home’: 'home'', | |
'login': loginFunction, | |
}); |
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
var PortfolioRoute = BaseRoute.extend({ | |
prepare: function() { | |
this.promise = …; | |
return this.promise; | |
}, | |
render: function() { … }, | |
error: function() { … } | |
}); |
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
beforeRender: function() { | |
this.model = new Account(); | |
return this.model.fetch(); | |
} |
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
onRender: function() { | |
this.preloadStart(); | |
this.loadSomeDataWeNeed().then(this.preloadComplete); | |
}, | |
loadSomeDataWeNeed: function() { | |
this.account = new Account(); | |
return this.account.fetch(); | |
}, | |
preloadStart: function() { | |
// hide $el and show loading indicator | |
}, | |
preloadComplete: function() { | |
// show $el and hide loading indicator | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment