mirror of
https://bitbucket.org/bellord13/kit.git
synced 2026-11-13 19:06:11 +03:00
fix
This commit is contained in:
+15
-7
@@ -15,10 +15,17 @@ window.kit = window.kit || {};
|
||||
loader: 'loader',
|
||||
import: 'import',
|
||||
};
|
||||
var PluginManager = function(global, modules = {}){
|
||||
|
||||
/**
|
||||
* @class PluginManager
|
||||
* @param global
|
||||
* @param plugins
|
||||
* @constructor
|
||||
*/
|
||||
var PluginManager = function(global, plugins = {}){
|
||||
this.plugins = {};
|
||||
this.global = global;
|
||||
this.registerPlugins(modules);
|
||||
this.registerPlugins(plugins);
|
||||
};
|
||||
|
||||
var __proto = PluginManager.prototype;
|
||||
@@ -580,6 +587,7 @@ window.kit = window.kit || {};
|
||||
var defaultConfig = {
|
||||
defaultPath: '',
|
||||
requiredDependencies: [],
|
||||
autoloadPluginList: [],
|
||||
debug: false,
|
||||
};
|
||||
var manager = new PluginManager(global);
|
||||
@@ -592,18 +600,18 @@ window.kit = window.kit || {};
|
||||
});
|
||||
manager.install('PluginManager');
|
||||
manager.register('config', {
|
||||
alias: 'pm',
|
||||
type: moduleTypeList.loader,
|
||||
loader: function(module, exports, require, global) {
|
||||
global.config = global.config || {};
|
||||
global.config = Object.assign(defaultConfig, global.config);
|
||||
var config = global.config || {};
|
||||
config = Object.assign({}, defaultConfig, config);
|
||||
window.__pmConfig__ = global.config = config;
|
||||
}
|
||||
});
|
||||
manager.install('config');
|
||||
|
||||
global.PluginManager = manager;
|
||||
window.__PluginManager__ = global.PluginManager = global.pm = manager;
|
||||
global.ready = manager.ready.bind(manager);
|
||||
global.exec = manager.exec.bind(manager);
|
||||
global.require = manager.require.bind(manager);
|
||||
})(kit || window);
|
||||
})(kit);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
kit.PluginManager.registerPlugins({
|
||||
__PluginManager__.registerPlugins({
|
||||
menu: {
|
||||
path: kit.config.defaultPath + '/menu',
|
||||
path: __pmConfig__.defaultPath + '/menu',
|
||||
module: '/menu.js',
|
||||
css: [
|
||||
'/menu.css'
|
||||
@@ -9,28 +9,28 @@ kit.PluginManager.registerPlugins({
|
||||
deps: ['lib', 'align', 'utils']
|
||||
},
|
||||
lib: {
|
||||
path: kit.config.defaultPath + '/lib',
|
||||
path: __pmConfig__.defaultPath + '/lib',
|
||||
module: '/lib.js',
|
||||
type: 'loader',
|
||||
},
|
||||
align: {
|
||||
path: kit.config.defaultPath + '/align',
|
||||
path: __pmConfig__.defaultPath + '/align',
|
||||
module: '/align.js',
|
||||
type: 'loader',
|
||||
},
|
||||
utils: {
|
||||
path: kit.config.defaultPath + '/utils',
|
||||
path: __pmConfig__.defaultPath + '/utils',
|
||||
module: '/utils.js',
|
||||
type: 'loader',
|
||||
},
|
||||
jquery: {
|
||||
path: kit.config.defaultPath + '/jquery',
|
||||
path: __pmConfig__.defaultPath + '/jquery',
|
||||
module: '/jquery.min.js',
|
||||
type: 'loader',
|
||||
alias: '$',
|
||||
},
|
||||
tooltip: {
|
||||
path: kit.config.defaultPath + '/tooltip',
|
||||
path: __pmConfig__.defaultPath + '/tooltip',
|
||||
module: '/tooltip.js',
|
||||
type: 'loader',
|
||||
css: '/tooltip.css',
|
||||
@@ -40,13 +40,13 @@ kit.PluginManager.registerPlugins({
|
||||
deps: ['popper', 'bsCore'],
|
||||
},
|
||||
popper: {
|
||||
path: kit.config.defaultPath + '/popper',
|
||||
path: __pmConfig__.defaultPath + '/popper',
|
||||
alias: 'popper.js',
|
||||
module: '/popper.js',
|
||||
type: 'loader',
|
||||
},
|
||||
bsCore: {
|
||||
path: kit.config.defaultPath + '/bsCore',
|
||||
path: __pmConfig__.defaultPath + '/bsCore',
|
||||
module: '/bsCore.js',
|
||||
type: 'loader',
|
||||
css: [
|
||||
@@ -54,20 +54,20 @@ kit.PluginManager.registerPlugins({
|
||||
]
|
||||
},
|
||||
mask: {
|
||||
path: kit.config.defaultPath + '/mask',
|
||||
path: __pmConfig__.defaultPath + '/mask',
|
||||
module: '/mask.js',
|
||||
type: 'loader',
|
||||
deps: ['jquery'],
|
||||
},
|
||||
toolkit: {
|
||||
path: kit.config.defaultPath + '/toolkit',
|
||||
path: __pmConfig__.defaultPath + '/toolkit',
|
||||
module: '/toolkit.js',
|
||||
type: 'loader',
|
||||
css: ['/toolkit.css'],
|
||||
deps: ['jquery', 'mask'],
|
||||
},
|
||||
modal: {
|
||||
path: kit.config.defaultPath + '/modal',
|
||||
path: __pmConfig__.defaultPath + '/modal',
|
||||
module: '/modal.js',
|
||||
type: 'loader',
|
||||
css: [
|
||||
@@ -92,7 +92,7 @@ kit.PluginManager.registerPlugins({
|
||||
},
|
||||
},
|
||||
collapse: {
|
||||
path: kit.config.defaultPath + '/collapse',
|
||||
path: __pmConfig__.defaultPath + '/collapse',
|
||||
module: '/collapse.js',
|
||||
type: 'loader',
|
||||
css: [
|
||||
@@ -106,7 +106,7 @@ kit.PluginManager.registerPlugins({
|
||||
},
|
||||
},
|
||||
datepicker: {
|
||||
path: kit.config.defaultPath + '/datepicker',
|
||||
path: __pmConfig__.defaultPath + '/datepicker',
|
||||
module: '/js/datepicker.js',
|
||||
type: 'loader',
|
||||
css: [
|
||||
@@ -122,16 +122,17 @@ kit.PluginManager.registerPlugins({
|
||||
|
||||
});
|
||||
|
||||
kit.config.debug && (function(){
|
||||
__pmConfig__.debug && (function(){
|
||||
console.log('%ckit.reg', 'color:#2053ff');
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
console.log('%cDOMContentLoaded', 'color:#2053ff');
|
||||
});
|
||||
kit.exec(function () {
|
||||
__PluginManager__.exec(function () {
|
||||
console.log('%ckit.exec', 'color:#2053ff');
|
||||
});
|
||||
kit.ready(function () {
|
||||
console.log('%ckit.ready', 'color:#2053ff');
|
||||
});
|
||||
}());
|
||||
|
||||
__PluginManager__.ready(__pmConfig__.autoloadPluginList, function () {
|
||||
__pmConfig__.debug && (function() {
|
||||
console.log('%ckit.ready', 'color:#2053ff');
|
||||
}());
|
||||
});
|
||||
Reference in New Issue
Block a user