lib/view.js
function render() {
	debug('render `%s`', this.toString());
	var self = this;

	function invokeBeforeRender() {
		debug('invoke before render `%s`', self.toString());
		var deferBeforeRender = Q.defer()
			, resolve = deferBeforeRender.resolve
			, reject = deferBeforeRender.reject;

		if(!_.isUndefined(self.beforeRender)) {
			self.beforeRender(resolve, reject);
		} else {
			resolve();
		}

		return deferBeforeRender.promise;
	}

	function invokeRender() {
		debug('invoke render `%s`', self.toString());
		if(!_.isUndefined(self.renderView)) {
			self.renderView();
		}
	}

	function invokeAfterRender() {
		debug('invoke after render `%s`', self.toString());
		var deferAfterRender = Q.defer()
			, resolve = deferAfterRender.resolve
			, reject = deferAfterRender.reject;

		if(!_.isUndefined(self.afterRender)) {
			self.afterRender(resolve, reject);
		} else {
			resolve();
		}

		return deferAfterRender.promise;
	}

	return invokeBeforeRender()
		.then(invokeRender)
		.then(invokeAfterRender)
		.then(self.renderSubviews.bind(self));
}
function render() {
	debug('render `%s`', this.toString());
	var self = this;

	function invokeBeforeRender() {
		debug('invoke before render `%s`', self.toString());
		var deferBeforeRender = Q.defer()
			, resolve = deferBeforeRender.resolve
			, reject = deferBeforeRender.reject;

		if(!_.isUndefined(self.beforeRender)) {
			self.beforeRender(resolve, reject);
		} else {
			resolve();
		}

		return deferBeforeRender.promise;
	}

	function invokeRender() {
		debug('invoke render `%s`', self.toString());
		if(!_.isUndefined(self.renderView)) {
			self.renderView();
		}
	}

	function invokeAfterRender() {
		debug('invoke after render `%s`', self.toString());
		var deferAfterRender = Q.defer()
			, resolve = deferAfterRender.resolve
			, reject = deferAfterRender.reject;

		if(!_.isUndefined(self.afterRender)) {
			self.afterRender(resolve, reject);
		} else {
			resolve();
		}

		return deferAfterRender.promise;
	}

	return invokeBeforeRender()
		.then(invokeRender)
		.then(invokeAfterRender)
		.then(self.renderSubviews.bind(self));
}
function render ( ) { debug ( 'render `%s`' , this . toString ( ) ) ; var self = this ; function invokeBeforeRender ( ) { debug ( 'invoke before render `%s`' , self . toString ( ) ) ; var deferBeforeRender = Q . defer ( ) , resolve = deferBeforeRender . resolve , reject = deferBeforeRender . reject ; if ( ! _ . isUndefined ( self . beforeRender ) ) { self . beforeRender ( resolve , reject ) ; } else { resolve ( ) ; } return deferBeforeRender . promise ; } function invokeRender ( ) { debug ( 'invoke render `%s`' , self . toString ( ) ) ; if ( ! _ . isUndefined ( self . renderView ) ) { self . renderView ( ) ; } } function invokeAfterRender ( ) { debug ( 'invoke after render `%s`' , self . toString ( ) ) ; var deferAfterRender = Q . defer ( ) , resolve = deferAfterRender . resolve , reject = deferAfterRender . reject ; if ( ! _ . isUndefined ( self . afterRender ) ) { self . afterRender ( resolve , reject ) ; } else { resolve ( ) ; } return deferAfterRender . promise ; } return invokeBeforeRender ( ) . then ( invokeRender ) . then ( invokeAfterRender ) . then ( self . renderSubviews . bind ( self ) ) ; }
Function: render
Overwrites the default Backbone.View.render method. It automatically
invokes "renderView" and <renderSubviews>.

If you define a beforeRender or afterRender function in your <View>
implementation, that function will be called before / after the actual
rendering takes / took place.

Attention:
* Do *not* overwrite this method as you are used to from "normal" Backbone
view implementations. Create a *renderView* method in your view instead!
* Make sure you implement a renderView() function for your concrete
view.

See also:
* <renderSubviews>
Function : render Overwrites the default Backbone . View . render method . It automatically invokes renderView and <renderSubviews > .