Skip to content

Instantly share code, notes, and snippets.

@meatcar
Created November 22, 2012 18:56
Show Gist options
  • Save meatcar/4132548 to your computer and use it in GitHub Desktop.
Save meatcar/4132548 to your computer and use it in GitHub Desktop.
// 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