Skip to content

Instantly share code, notes, and snippets.

@canonic-epicure
Created January 3, 2011 21:21
Show Gist options
  • Save canonic-epicure/763985 to your computer and use it in GitHub Desktop.
Save canonic-epicure/763985 to your computer and use it in GitHub Desktop.
var NativeSuperizer = function () {
var method = arguments.callee.caller
this.meta.superizeMethod(method.name)
return this.SUPER.apply(this, arguments)
}
superizeMethod = function (name) {
var proto = this.c.prototype
var chain = [ NativeSuperizer ].concat( this.getInheritanceChainForMethod(name).reverse )
var index = 0
proto[ name ] = function () {
this.SUPER = chain[ i + 1 ]
var res = chain[ ++i ].apply(this, arguments)
this.SUPER = chain[ --i ]
return res
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment