Created
December 20, 2012 07:52
-
-
Save nakamura-to/4343626 to your computer and use it in GitHub Desktop.
Intercepting the Backbone.View initialize method.
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
var _View = Backbone.View; | |
Backbone.View = function () { | |
logger.info('before'); | |
var init = this.initialize; | |
if (init) { | |
this.initialize = function () { | |
logger.info('before initialize'); | |
init.call(this); | |
logger.info('after initialize'); | |
}.bind(this); | |
} | |
_View.apply(this, arguments); | |
logger.info('after'); | |
}; | |
Backbone.View.prototype = _View.prototype; | |
Backbone.View.extend = _View.extend; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment