Closed 0xgeert closed 11 years ago
@gbrits There's no way to access the remover from the joinpoint
. The reasoning is that the remover should primarily be available to the code that adds the advice.
If you need to create self-removing advice, one option would be to capture the remover:
var remover = meld.before(object, 'method', function(/* args */) {
// Remove myself
remover.remove();
// do other things here, for example
beforeFunction.apply(null, arguments);
});
Will that work for you?
Nevermind, solved is in another way. Thanks.
Ok, cool, glad to hear you have a solution.
Given (from the docs) var remover = meld.before(object, match, beforeFunction);
Is there a way to get a handle to 'remover' in the body of beforeFunction?