Skip to content

Instantly share code, notes, and snippets.

@jrmlstf
Forked from sagar-ganatra/WrapRenderFunction.js
Created July 2, 2013 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrmlstf/5907735 to your computer and use it in GitHub Desktop.
Save jrmlstf/5907735 to your computer and use it in GitHub Desktop.
(function () {
var TestView = Backbone.View.extend({
el: '#container',
initialize: function () {
console.log('Inside Init');
this.render = _.wrap(this.render, function(render) {
this.beforeRender();
render();
this.afterRender();
});
this.render();
},
render: function () {
console.log('Inside render');
return this;
},
beforeRender: function () {
console.log("Before render");
},
afterRender: function () {
console.log("After render");
}
});
var testViewInstance = new TestView;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment