noop Firebug for other browsers

If you’ve left console.log statements in your code intentionally or by mistake, the following will allow a successful noop in browsers for which Firebug is either not installed, disabled, or uninstallable.

liaison.util.firebug = function() {
	(function() {
		if(!window.console) {
			console = {};
			console.log = Ext.emptyFn;
		}
	})();
};

One Comment

  1. Posted 1/13/2009 at 3:39 pm | Permalink

    This is really useful stuff - I’m always forgetting to remove console.log lines. It might be better to just define an empty function instead of using Ext.emptyFn as then you can use this anywhere…

    Nice to see another Ext blog - keep it up!

Post a Comment

Your email is never shared. Required fields are marked *

*
*