View Full Version : Any way to tell if dev, debug, or normal version of Ext is being used?

26 Jul 2013, 12:58 PM
Basically, I have a global javascript error handler and there's some code I want to run when in production that will display an error MessageBox and also run an ajax request to log the error on the server, but I don't need it running on dev. Since on dev I'm using ext-all-debug.js while on prod it's ext-all.js, I wondered if there was any property somewhere that would indicate which you're running. I can easily get around it another way, but thought it would be the cleanest way as opposed to relying on setting a variable myself somewhere.

Gary Schlosberg
29 Jul 2013, 8:22 PM
No built-in way of determining which library file you've used, so if you can easily get around it another way, that's probably your best bet.

29 Jul 2013, 11:25 PM
One way to get it is using DomQuery in ExtJS:


or go crazy with an override:

Ext.define('ExtScriptMeta', {
override: 'Ext.versions',
script : Ext.DomQuery.select('script[src^=ext]')[0].src.split('/').reverse()[0].split('.')[0],

parseVersion : function(script) {

initialize : function() {

isDebug : function() {
if ( Ext.Array.contains(this.script,'debug') ) { return true }
return false;

isDev : function() {
if ( Ext.Array.contains(this.script,'dev') ) { return true }
return false;

isProduction : function() {
if ( Ext.Array.contains(this.script,'debug') && Ext.Array.contains(this.script,'dev') ) { return true }
return false;

isAll : function() {
if ( Ext.Array.contains(this.script,'all')) { return true }
return false;


30 Jul 2013, 2:55 AM
Take a look at this thread