create: function() { var name = arguments[0], nameType = typeof name, args = arraySlice.call(arguments, 1), cls; if (nameType === ‘function‘) { cls = name; } else { if (nameType !== ‘string‘ && args.length === 0) { args = [ name ]; if (!(name = name.xclass)) { name = args[0].xtype; if (name) { name = ‘widget.‘ + name; } } } if (typeof name !== ‘string‘ || name.length < 1) { throw new Error("[Ext.create] Invalid class name or alias ‘" + name + "‘ specified, must be a non-empty string"); } name = Manager.resolveName(name); cls = Manager.get(name); } // Still not existing at this point, try to load it via synchronous mode as the last resort if (!cls) { Ext.log.warn("[Ext.Loader] Synchronously loading ‘" + name + "‘; consider adding " + "Ext.require(‘" + name + "‘) above Ext.onReady"); Ext.syncRequire(name); cls = Manager.get(name); } if (!cls) { throw new Error("[Ext.create] Unrecognized class name / alias: " + name); } if (typeof cls !== ‘function‘) { throw new Error("[Ext.create] Singleton ‘" + name + "‘ cannot be instantiated."); } return Manager.getInstantiator(args.length)(cls, args); },
原文地址:https://www.cnblogs.com/xsSystem/p/9236501.html
时间: 2024-11-05 06:54:47