Ext中在每一个页面中添加一个namespace呢,就像下面的代码:
下面是Ext.nameSpace的API:
// create namespace
Ext.namespace('myNameSpace');
// create application
myNameSpace.app = function() {
// do NOT access DOM from here; elements don't exist yet
// private variables
// private functions
// public space
return {
// public properties, e.g. strings to translate
// public methods
init: function() {
alert('Application successfully initialized');
}
};
}(); // end of app
下面是Ext.nameSpace的API:
namespace( String namespace1, String namespace2, String etc ) : void
Creates namespaces to be used for scoping variables and classes so that they are not global. Usage: Ext.namespace('C...
Creates namespaces to be used for scoping variables and classes so that they are not global. Usage:
Ext.namespace('Company', 'Company.data');
Company.Widget = function() { ... }
Company.data.CustomStore = function(config) { ... }
Parameters:
* namespace1 : String
* namespace2 : String
* etc : String
Returns:
* void