Created
November 22, 2012 18:56
-
-
Save meatcar/4132548 to your computer and use it in GitHub Desktop.
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
// Version 1 | |
var view = new view({ | |
initialize: function () { | |
this.html(this.template({})); | |
this.partview = new PartView({ | |
el: this.$('.class-part1') | |
}); | |
this.partview2 = new PartView({ | |
el: this.$('.class-part2') | |
}); | |
}, | |
render: function () { | |
this.partview.render(); | |
this.partview.render2(); | |
} | |
}); | |
// Version 2 | |
var view = new view({ | |
initialize: function () { | |
}, | |
render: function () { | |
this.html(this.template({})); | |
this.partview = new PartView({ | |
el: this.$('.class-part1') | |
}); | |
this.partview.render(); // Optionally, each partview renders on initialize | |
this.partview2 = new PartView({ | |
el: this.$('.class-part2') | |
}); | |
this.partview.render2(); | |
} | |
}); | |
// Version 3 | |
var view = new view({ | |
initialize: function () { | |
}, | |
render: function () { | |
this.html(this.template({})); | |
this.partview = new PartView({ | |
}); | |
this.$('.class-part1').html(this.partview.el); | |
this.partview2 = new PartView({ | |
el: this.$('.class-part2') | |
}); | |
this.$('.class-part2').html(this.partview2.el); | |
// Assuming each partview renders itself on initialize. | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment