I don't know anything built-in that does this, but you can do it yourself, iterating through jQuery.fn
(i.e. you would override these functions, as Felix Kling suggested):
var callbacks = {}; var excluded = ['constructor','init','jquery']; for ( var key in $.fn ) { var orig = $.fn[key]; if ( !orig instanceof Function || excluded.indexOf(key) != -1 ) continue; (function(key,orig) { callbacks[key] = [];
Then you just need to add / remove callbacks to the corresponding entry in the callbacks
object.
Update: I don’t know what I don’t see here, but I can’t make an example , (Edit: ah, a classic error that forgets to wrap variables in closure ... it should work now. Also, an excluded
list is added for functions that should not be overridden )
source share