Last active
December 31, 2015 01:29
-
-
Save IUnknown68/7914565 to your computer and use it in GitHub Desktop.
Logs all calls on a DOM window (or any other object) to the console by replacing the functions with a wrapper.
NOTE: This does not deal with errors, it is just for debugging purposes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var target = window; | |
for (var i in target) { | |
if ("function" != typeof target[i]) continue; | |
target[i] = (function(name, fn) { | |
return function() { | |
console.log("" + name + " called"); | |
return fn.apply(target, arguments); | |
} | |
})(i, target[i]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment