Created
April 26, 2014 22:04
-
-
Save rorysaur/11332353 to your computer and use it in GitHub Desktop.
purpose of app-wide bases in backbone
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
App.Views.ViewBase = Backbone.View.extend({ | |
childViews: [], | |
addChild: function(view) { | |
// etc | |
}, | |
close: function() { | |
this.childViews.forEach(function(childView) { | |
childView.close(); | |
}); | |
this.remove(); | |
}, | |
removeChild: function(view) { | |
// etc | |
} | |
}); | |
App.Views.MinersIndex = App.Views.ViewBase.extend({ | |
}); | |
App.Collections.CollectionBase = Backbone.Collection.extend({ | |
parse: function(data) { | |
// perhaps all calls to your api come back with stuff in the 'results' property | |
return data.results; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
damn it, rory. you're the ninja everyone is looking for.