Skip to content

Instantly share code, notes, and snippets.

@mferrier
Created August 21, 2012 16:41
Show Gist options
  • Save mferrier/3417163 to your computer and use it in GitHub Desktop.
Save mferrier/3417163 to your computer and use it in GitHub Desktop.
debugjs.js
var LOG_FN = function(name) {
window.fn_counts = window.fn_counts || {};
if (window.fn_counts[name] === undefined) {
window.fn_counts[name] = [1,1];
} else {
window.fn_counts[name][0] += 1;
window.fn_counts[name][1] += 1;
}
console.log("calling " + name + " (" + window.fn_counts[name][0] + " recent, " + window.fn_counts[name][1] + " all time)");
};
setInterval(function(){
if (window.ping === undefined) {
window.ping = 1;
} else {
window.ping += 1;
}
for (key in window.fn_counts) {
window.fn_counts[key][0] = 0;
}
console.log('ping ' + window.ping);
}, 3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment