Ext.ClassManager manages all classes and handles mapping from string class name to actual class objects throughout the whole framework. It is not generally accessed directly, rather through these convenient shorthands:
Defines a class. This is usually invoked via the alias Ext.define
Ext.ClassManager.create('My.awesome.Class', {
someProperty: 'something',
someMethod: function() { ... }
...
}, function() {
alert('Created!');
alert(this === My.awesome.Class); // alerts true
var myInstance = new this();
});
The class name to create in string dot-namespaced format, for example: 'My.very.awesome.Class', 'FeedViewer.plugin.CoolPager' It is highly recommended to follow this simple convention:
The key - value pairs of properties to apply to this class. Property names can be of any valid strings, except those in the reserved listed below:
mixins
statics
config
alias
self
singleton
alternateClassName
Optional callback to execute after the class is created, the execution scope of which
(this
) will be the newly created class itself.
Retrieve a class by its name.
Retrieve a class by its name.
class
Get the aliases of a class by the class name
Get the aliases of a class by the class name
aliases
Get a reference to the class by its alias.
Get a reference to the class by its alias.
class
Get the class of the provided object; returns null if it's not an instance of any class created with Ext.define. This is usually invoked by the shorthand Ext.getClass
var component = new Ext.Component();
Ext.ClassManager.getClass(component); // returns Ext.Component
class
Get the name of the class by its reference or its instance; usually invoked by the shorthand Ext.getClassName
Ext.ClassManager.getName(Ext.Action); // returns "Ext.Action"
className
Get the name of a class by its alias.
Get the name of a class by its alias.
className
Get the name of a class by its alternate name.
Get the name of a class by its alternate name.
className
Converts a string expression to an array of matching class names. An expression can either refers to class aliases or class names. Expressions support wildcards:
// returns ['Ext.window.Window']
var window = Ext.ClassManager.getNamesByExpression('widget.window');
// returns ['widget.panel', 'widget.window', ...]
var allWidgets = Ext.ClassManager.getNamesByExpression('widget.*');
// returns ['Ext.data.Store', 'Ext.data.ArrayProxy', ...]
var allData = Ext.ClassManager.getNamesByExpression('Ext.data.*');
classNames
Instantiate a class by either full name, alias or alternate name; usually invoked by the convenient shorthand Ext.create
If Ext.Loader is enabled and the class has not been defined yet, it will attempt to load the class via synchronous loading.
For example, all these three lines return the same result:
// alias
var window = Ext.ClassManager.instantiate('widget.window', { width: 600, height: 800, ... });
// alternate name
var window = Ext.ClassManager.instantiate('Ext.Window', { width: 600, height: 800, ... });
// full class name
var window = Ext.ClassManager.instantiate('Ext.window.Window', { width: 600, height: 800, ... });
,... Additional arguments after the name will be passed to the class' constructor.
instance
Instantiate a class by its alias; usually invoked by the convenient shorthand Ext.createByAlias If Ext.Loader is enabled and the class has not been defined yet, it will attempt to load the class via synchronous loading.
var window = Ext.ClassManager.instantiateByAlias('widget.window', { width: 600, height: 800, ... });
,... Additional arguments after the alias will be passed to the class constructor.
instance
Checks if a class has already been created.
Checks if a class has already been created.
exist
Register a post-processor function.
Register a post-processor function.
Sets a name reference to a class.
Sets a name reference to a class.
this
Register the alias for a class.
Register the alias for a class.
a reference to a class or a className
Alias to use when referring to this class
Insert this post-processor at a specific position in the stack, optionally relative to any existing post-processor
Insert this post-processor at a specific position in the stack, optionally relative to any existing post-processor
The post-processor name. Note that it needs to be registered with registerPostprocessor before this
The insertion position. Four possible values are: 'first', 'last', or: 'before', 'after' (relative to the name provided in the third argument)
this
Set the default post processors array stack which are applied to every class.
Set the default post processors array stack which are applied to every class.
name of a registered post processor or an array of registered names.
this
Creates a namespace and assign the value
to the created object
Ext.ClassManager.setNamespace('MyCompany.pkg.Example', someObject);
alert(MyCompany.pkg.Example === someObject); // alerts true