• Ext.create


          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);
            },
  • 相关阅读:
    A
    博弈论
    K
    快速幂
    基数排序
    计数排序
    KMP求字符串最小循环节
    二分图多重匹配
    hdu2818行列匹配+排序
    二分图行列匹配与最大匹配必须边
  • 原文地址:https://www.cnblogs.com/xsSystem/p/9236501.html
Copyright © 2020-2023  润新知