mirror of
https://bitbucket.org/bellord13/kit.git
synced 2026-11-13 19:06:11 +03:00
fix
This commit is contained in:
+18
-7
@@ -436,12 +436,13 @@ window.kit = window.kit || {};
|
||||
* @return {boolean}
|
||||
*/
|
||||
__proto.require = function (pluginId, callback) {
|
||||
//console.warn('PluginManager.require: plugin ' + pluginId + ' ('+(this.plugins[pluginId]?this.plugins[pluginId].state:'0')+')');
|
||||
|
||||
var plugin = this.__getPlugin(pluginId);
|
||||
if(plugin) {
|
||||
pluginId = plugin.id;
|
||||
if(!plugin) {
|
||||
console.warn('PluginManager.require: plugin ' + pluginId + ' not found ('+(this.plugins[pluginId]?this.plugins[pluginId].state:'0')+')');
|
||||
return undefined;
|
||||
}
|
||||
pluginId = plugin.id;
|
||||
var module = plugin.module;
|
||||
|
||||
if(!this.__checkState(pluginId, stateList.registered)) {
|
||||
@@ -578,15 +579,25 @@ window.kit = window.kit || {};
|
||||
if(this.plugins.hasOwnProperty(pluginId)) {
|
||||
return this.plugins[pluginId];
|
||||
}
|
||||
var _pluginId;
|
||||
var _pluginId, alias;
|
||||
for (_pluginId in this.plugins) {
|
||||
if(this.plugins.hasOwnProperty(_pluginId) && this.plugins[_pluginId].config.alias.indexOf(pluginId) !== -1) {
|
||||
return this.plugins[_pluginId];
|
||||
}
|
||||
}
|
||||
_pluginId = pluginId[0].toUpperCase() + pluginId.slice(1);
|
||||
if(_pluginId !== pluginId) {
|
||||
return this.__getPlugin(_pluginId);
|
||||
var pluginIdLowerCase = pluginId.toLowerCase();
|
||||
for (_pluginId in this.plugins) {
|
||||
if(!this.plugins.hasOwnProperty(_pluginId)) {
|
||||
continue;
|
||||
}
|
||||
if(pluginIdLowerCase === _pluginId.toLowerCase()) {
|
||||
return this.plugins[_pluginId];
|
||||
}
|
||||
for(alias of this.plugins[_pluginId].config.alias) {
|
||||
if(pluginIdLowerCase === alias.toLowerCase()) {
|
||||
return this.plugins[_pluginId];
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user