Skip to content

Instantly share code, notes, and snippets.

@paulirish
Created January 12, 2010 19:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save paulirish/275532 to your computer and use it in GitHub Desktop.
Save paulirish/275532 to your computer and use it in GitHub Desktop.
// sorta like manual profiling.
// peek into your jquery method calls to see why they are being called so much
// usage:
// $.logCallsTo('append');
// $.logCallsTo('curCSS',true);
// output:
// http://gyazo.com/40cec25d875a7a767e95fd7a2f451b32.png
$.logCallsTo = function(method,isOn$){
var old = isOn$ ? $[method] : $.fn[method],
that = this;
(isOn$ ? $ : $.fn)[method] = function(){
window.console && console.log.apply(console,[this,method,arguments]);
return old.apply(this,arguments);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment