mirror of
https://bitbucket.org/bellord13/kit.git
synced 2026-11-13 19:06:11 +03:00
fix
This commit is contained in:
+30
-2
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
window.kit = window.kit || {};
|
||||
(function(global){
|
||||
var stackPromise = {};
|
||||
var stateList = {
|
||||
undefined: 0,
|
||||
registered: 1,
|
||||
@@ -464,9 +463,23 @@ window.kit = window.kit || {};
|
||||
};
|
||||
|
||||
__proto.exec = function (deps, callback, argArr = []) {
|
||||
if(!Array.isArray(deps)) {
|
||||
|
||||
if(typeof deps === 'function') {
|
||||
argArr = callback;
|
||||
callback = deps;
|
||||
deps = [];
|
||||
}
|
||||
|
||||
if(!Array.isArray(deps) ) {
|
||||
deps = [deps];
|
||||
}
|
||||
|
||||
if(typeof argArr === 'undefined') {
|
||||
argArr = [];
|
||||
}
|
||||
|
||||
deps = Array.from(new Set(deps.concat(global.config.requiredDependencies)));
|
||||
|
||||
if(typeof callback !== 'function') {
|
||||
return undefined;
|
||||
}
|
||||
@@ -544,6 +557,10 @@ window.kit = window.kit || {};
|
||||
return undefined;
|
||||
};
|
||||
|
||||
var defaultConfig = {
|
||||
defaultPath: '',
|
||||
requiredDependencies: [],
|
||||
};
|
||||
var manager = new PluginManager(global);
|
||||
manager.register('PluginManager', {
|
||||
alias: 'pm',
|
||||
@@ -553,6 +570,17 @@ window.kit = window.kit || {};
|
||||
}
|
||||
});
|
||||
manager.install('PluginManager');
|
||||
manager.register('config', {
|
||||
alias: 'pm',
|
||||
type: moduleTypeList.loader,
|
||||
loader: function(module, exports, require, global) {
|
||||
console.warn('global.config', JSON.stringify(global.config));
|
||||
global.config = global.config || {};
|
||||
global.config = Object.assign(defaultConfig, global.config);
|
||||
}
|
||||
});
|
||||
manager.install('config');
|
||||
|
||||
global.PluginManager = manager;
|
||||
global.exec = manager.exec.bind(manager);
|
||||
global.require = manager.require.bind(manager);
|
||||
|
||||
Reference in New Issue
Block a user