whatsappicloudtweetdeckhipchattelegramhangoutsslackgmailskypefacebook-workplaceoutlookemailmicrosoft-teamsdiscordmessengercustom-servicesmacoslinuxwindowsinbox
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.8 KiB
71 lines
1.8 KiB
/** |
|
* @private |
|
* @class Ext.app.Util |
|
*/ |
|
Ext.define('Ext.app.Util', { |
|
}, function() { |
|
Ext.apply(Ext.app, { |
|
namespaces: { |
|
Ext: {} |
|
}, |
|
|
|
/** |
|
* Adds namespace(s) to known list. |
|
* @private |
|
* |
|
* @param {String/String[]} namespace |
|
*/ |
|
addNamespaces: function(namespace) { |
|
var namespaces = Ext.app.namespaces, |
|
i, l; |
|
|
|
if (!Ext.isArray(namespace)) { |
|
namespace = [namespace]; |
|
} |
|
|
|
for (i = 0, l = namespace.length; i < l; i++) { |
|
namespaces[namespace[i]] = true; |
|
} |
|
}, |
|
|
|
/** |
|
* @private Clear all namespaces from known list. |
|
*/ |
|
clearNamespaces: function() { |
|
Ext.app.namespaces = {}; |
|
}, |
|
|
|
/** |
|
* Get namespace prefix for a class name. |
|
* @private |
|
* @param {String} className |
|
* |
|
* @return {String} Namespace prefix if it's known, otherwise undefined |
|
*/ |
|
getNamespace: function(className) { |
|
var namespaces = Ext.apply({}, Ext.ClassManager.paths, Ext.app.namespaces), |
|
deepestPrefix = '', |
|
prefix; |
|
|
|
for (prefix in namespaces) { |
|
if (namespaces.hasOwnProperty(prefix) && |
|
prefix.length > deepestPrefix.length && |
|
(prefix + '.' === className.substring(0, prefix.length + 1))) { |
|
deepestPrefix = prefix; |
|
} |
|
} |
|
|
|
return deepestPrefix === '' ? undefined : deepestPrefix; |
|
} |
|
}); |
|
|
|
/** |
|
* @method getNamespace |
|
* @member Ext |
|
* @param {String} className |
|
* |
|
* @return {String} Namespace prefix if it's known, otherwise undefined |
|
*/ |
|
Ext.getNamespace = Ext.app.getNamespace; |
|
|
|
}); |