Something I stumbled across when I wanted to hook into all my custom $.event.trigger();
jQuery events, to see what was going on without having to console.log every single one of them. To my surprise, it produced much more events than just my own. Apparently jQuery uses its own event.trigger
method a lot (which I did not know).
So, make your console light up like a Christmas-tree by exposing nearly all events fired within jQuery (including those you cause with your own scripts) by adding this code:
//hijack event (function($) { // maintain a reference to the existing function var oldEvent = $.event.trigger; // ...before overwriting the jQuery extension point $.event.trigger = function(e) { // original behavior - use function.apply to preserve context var ret = oldEvent.apply(this, arguments); if (e.type) console.log(e.type + ' event fired:'); console.log(e); // preserve return value (probably the jQuery object...) return ret; }; })(jQuery);
No Responses