You can have a look at how it is handled in Archetype Components (an Open
Source Framework based on Prototype). It's called MethodBuilder, but this is
basically a Facet in AOP.
It does not just add a before and an after for any function of a component,
but it also provides some really enjoyable
2008/5/14 Pat Nakajima [EMAIL PROTECTED]:
I've started putting together a way to specify per-object before/after
callbacks for any method. Probably not something to go in core, but
maybe something that would be interesting to core contributors.
There are some examples in a GitHub wiki
With regards to your desire to skip the callbacks for some methods,
you can actually call methodWithoutCallbacks to call a method sans-
callbacks.
I think that the wildcard/regex idea is neat, though I'm not sure how
it could be accomplished unobtrusively. I could imagine overriding all
of the
2008/5/15 Pat Nakajima [EMAIL PROTECTED]:
With regards to your desire to skip the callbacks for some methods,
you can actually call methodWithoutCallbacks to call a method sans-
callbacks.
I think that the wildcard/regex idea is neat, though I'm not sure how
it could be accomplished
I have done something similar in Class.addBehavior:
http://github.com/kangax/protolicious/tree/master/class.addbehavior.js
On the other hand, it's actually pretty easy to do this with plain
Function#wrap:
(function(p){
p.push = p.push.wrap(function(){
var args = $A(arguments), proceed =