This commit is contained in:
2021-08-29 22:04:03 +03:00
parent df99e877e3
commit 7c153a2e6d
7 changed files with 46 additions and 12 deletions
+25 -4
View File
@@ -2,6 +2,7 @@
* @class kit
* @property {kit.bsCore}
* @property {kit.toolkit}
* @property {kit.Modal}
*/
window.kit = window.kit || {};
(function(global){
@@ -321,7 +322,7 @@ window.kit = window.kit || {};
loadStyle(configModule.path + item);
});
var depsPromise = this.__getDepsPromise(configModule.deps);
var depsPromise = this.__getDepsPromise(this.depsCorrection(configModule.deps));
setSkipLoadPromise(depsPromise);
if(depsPromise) {
@@ -447,6 +448,21 @@ window.kit = window.kit || {};
return module.exports;
};
__proto.depsCorrection = function(deps){
if(!Array.isArray(deps) ) {
deps = [deps];
}
var correct = [];
deps.forEach(function(pluginId, i, arr) {
var realPlugin = this.__getPlugin(pluginId);
if(realPlugin === undefined) {
return false;
}
correct.push(realPlugin.id);
}.bind(this));
return correct;
};
__proto.exec = function (deps, callback, argArr = [], context = undefined) {
if(typeof deps === 'function') {
@@ -458,9 +474,8 @@ window.kit = window.kit || {};
if(context === undefined) {
context = this;
}
if(!Array.isArray(deps) ) {
deps = [deps];
}
deps = this.depsCorrection(deps);
if(typeof argArr === 'undefined') {
argArr = [];
@@ -559,6 +574,12 @@ window.kit = window.kit || {};
return this.plugins[_pluginId];
}
}
var _pluginId = pluginId[0].toUpperCase() + pluginId.slice(1);
if(_pluginId !== pluginId) {
return this.__getPlugin(_pluginId);
}
return undefined;
};