This commit is contained in:
2024-06-27 08:55:12 +03:00
parent 27b7a21560
commit 543bb8d388
5 changed files with 36 additions and 3 deletions
+32
View File
@@ -848,6 +848,34 @@ kit.config = kit.config || {};
}.bind(this));
}
};
/**
* @param {(string|string[])} deps
* @param {function} callback
* @memberOf kit
*/
PluginManager.prototype.loaded = function(deps, callback = undefined) {
var self = this;
if(typeof deps === 'function') {
callback = deps;
deps = [];
}
if(typeof callback !== 'function') {
callback = function (){};
}
self.__loaded(self.exec, [deps, callback], self);
};
PluginManager.prototype.__loaded = function(fn, args = [], context = window) {
var self = this;
context = context || this;
if (/complete|interactive|loaded/.test(document.readyState)) {
fn.apply(context, args);
} else {
window.addEventListener("load", function () {
fn.apply(context, args);
}.bind(this));
}
};
PluginManager.prototype.require = function (pluginId, callback) {
@@ -885,6 +913,7 @@ kit.config = kit.config || {};
var manager = new PluginManager(global);
global.ready = manager.ready.bind(manager);
global.loaded = manager.loaded.bind(manager);
global.exec = manager.exec.bind(manager);
global.require = manager.require.bind(manager);
manager.register('pluginManager', {
@@ -932,6 +961,9 @@ kit.config = kit.config || {};
document.addEventListener("DOMContentLoaded", function () {
console.log('%cDOMContentLoaded', 'color:#2053ff');
});
window.addEventListener("load", (event) => {
console.log('%cWindowLoaded', 'color:#2053ff');
});
}());
},
onInstall: function(plugin){
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -201,7 +201,7 @@ var __PluginManagerConfigHandler__ = function() {
},
toolkit: {
path: root + '/toolkit',
module: '/toolkit.js',
module: '/toolkit.min.js',
type: 'HMD',
css: ['/toolkit.css'],
deps: ['jQuery', 'mask', 'support'],
File diff suppressed because one or more lines are too long
+1
View File
File diff suppressed because one or more lines are too long