Adding Deprecation Warning in JavaScript Console
I used this quick trick today to help me clean up and refactor some javascript functions today:
if ("console" in window)
console.warn('DEPRECATED function call to '+ arguments.callee
+'\nCalled by:\n'+ arguments.callee.caller );
Which results in a fine deprecation warning in the console:
There is plenty of space for improvement here. Feel free to use or tamper … but please post any alternative suggestions here as a comment.
July 17th, 2008 at 14:17 (GMT-1)
That’s a really neat little trick! Thanks for sharing Jesper.
July 18th, 2008 at 11:22 (GMT-1)
If you want to get the console output in Internet Explorer, you can install the Companion.JS plug-in:
http://www.my-debugbar.com/wiki/CompanionJS/HomePage