refactor(client) initModules

This commit is contained in:
coderaiser 2014-05-22 05:11:37 -04:00
parent 8a99584115
commit ef10353b7d

View file

@ -206,7 +206,7 @@ var Util, DOM, CloudFunc;
});
CloudCmd.getModules(function(modules) {
var i, n, module, storageObj, mod, name, path,
var storageObj, mod, path,
STORAGE = 'storage',
showLoad = Images.showLoad.bind(Images),
@ -227,29 +227,24 @@ var Util, DOM, CloudFunc;
if (!modules)
modules = [];
n = modules.length;
for (i = 0; i < n ; i++) {
module = modules[i];
modules.forEach(function(module) {
if (Util.isString(module))
load(null, module, doBefore[module]);
}
});
storageObj = Util.findObjByNameInArr(modules, STORAGE),
mod = Util.getNamesFromObjArray(storageObj);
for (i = 0, n = mod.length; i < n; i++) {
name = mod[i],
mod.forEach(function(name) {
path = STORAGE + '/_' + name.toLowerCase();
load(name, path, doBefore[path]);
}
});
Util.exec(callback);
});
}
function baseInit(pCallBack) {
var files = DOM.getFiles(),
LEFT = CloudFunc.PANEL_LEFT,