nl_tokens: A global factory method to instantiate a class from a config object . For example these two calls are equivalent :
pl_tokens: function ( config , classReference , instance , aliasNamespace ) { var manager = Ext . ClassManager , newInstance ; // If config is falsy or a valid instance, destroy the current instance // (if it exists) and replace with the new one if ( ! config || config . isInstance ) { if ( instance && instance !== config ) { <mask> . destroy ( ) ; } return config ; } if ( aliasNamespace ) { // If config is a string value, treat it as an alias if ( typeof config == 'string' ) { return manager . instantiateByAlias ( aliasNamespace + '.' + config ) ; } // Same if 'type' is given in config else if ( Ext . isObject ( config ) && 'type' in config ) { return manager . instantiateByAlias ( aliasNamespace + '.' + config . type , config ) ; } } if ( config === true ) { return instance || manager . instantiate ( classReference ) ; } //<debug error> if ( ! Ext . isObject ( config ) ) { Ext . Logger . error ( "Invalid config, must be a valid config object" ) ; } //</debug> if ( 'xtype' in config ) { newInstance = manager . instantiateByAlias ( 'widget.' + config . xtype , config ) ; } else if ( 'xclass' in config ) { newInstance = manager . instantiate ( config . xclass , config ) ; } if ( newInstance ) { if ( instance ) { instance . destroy ( ) ; } return newInstance ; } if ( instance ) { return instance . setConfig ( config ) ; } return manager . instantiate ( classReference , config ) ; }