View Full Version : Ext.isFirebug
mjlecomte
20 Dec 2008, 5:26 AM
Seems like it would be generally useful.
Ext.apply(Ext, {
isFirebug: (window.console && window.console.firebug)
});
usage:
if(Ext.isFirebug){
console.warn('Houston, we have a problem.');
}
hendricd
20 Dec 2008, 7:26 AM
@MJ -- How about Ext.hasConsole instead/as-well? Chrome, Safari and several IE extensions have added FB-style 'console' support to their Error/debugging stacks.
For a Firebug-specific check, you'd only need:
if(window._firebug){ }..
..for later releases.
mjlecomte
20 Dec 2008, 7:30 AM
Sure! Anything to help shut IE up when it encounters console statements.
hendricd
20 Dec 2008, 7:40 AM
@mj -- Also, I usually drop this in during development phases to handle that problem across browsers (some other short-cuts included) ;)
Ext.onReady(function(){
//Ext syntax sugar and FB console emulation
if(typeof console == 'undefined'){
if(typeof loadFirebugConsole == 'function'){ loadFirebugConsole(); } //For FF2
if(typeof console == 'undefined')
console = {log: Ext.debug?Ext.log:alert,dir: Ext.debug?Ext.dump:alert};
}
Ext.apply(window,{
$ : Ext.get
,$A: Ext.value
,$C : Ext.getCmp
,$D : Ext.getDom
,$$ : Ext.select
,$Q : Ext.query
,$on: Ext.EventManager.on
,$ready : Ext.onReady
,$l : console.log
,$cd: console.dir
,$for : typeof forEach != 'undefined'? forEach : Ext.each
});
});
mjlecomte
20 Dec 2008, 8:22 AM
Thanks Doug. I think I bookmarked when you posted that before and never came back around to it. Just tried it out and works fairly good, well...I should saw awesome compared to what pre IE8 offers on it's own.
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.