Tip: Click lines to highlight, hold ctrl/cmd to multi-select
javascript pointcut example (11-Nov @ 10:56)
This example intercepts the jQuery bind event and logs the number of calls
Syntax Highlighted Code
- /* This will intercept the jQuery bind event
- * and logs the number of calls
- */
- jQuery.fn.bind = function (bind) {
- return function () {
- console.count("jQuery bind count");
- console.log("jQuery bind %o", this);
- return bind.apply(this, arguments);
- };
- }(jQuery.fn.bind);
Plain Code
/* This will intercept the jQuery bind event
* and logs the number of calls
*/
jQuery.fn.bind = function (bind) {
return function () {
console.count("jQuery bind count");
console.log("jQuery bind %o", this);
return bind.apply(this, arguments);
};
}(jQuery.fn.bind);