diff --git a/lib/client.js b/lib/client.js index d2f13f53..1999aa31 100644 --- a/lib/client.js +++ b/lib/client.js @@ -82,50 +82,51 @@ var Util, DOM, CloudFunc; * function load modules * @pParams = {name, path, func, dobefore, arg} */ - function loadModule(pParams) { - var lName, lPath, lFunc, lDoBefore, lSlash, lAfterSlash, + function loadModule(params) { + var name, path, func, doBefore, slash, afterSlash, isContain; - if (pParams) { - lName = pParams.name, - lPath = pParams.path, - lFunc = pParams.func, - lDoBefore = pParams.dobefore; + if (params) { + name = params.name, + path = params.path, + func = params.func, + doBefore = params.dobefore; - if (Util.isString(pParams)) - lPath = pParams; + if (Util.isString(params)) + path = params; - if (lPath && !lName) { - lName = Util.getStrBigFirst(lPath); - lName = Util.removeStr(lName, '.js'); + if (path && !name) { + name = Util.getStrBigFirst(path); + name = Util.removeStr(name, '.js'); - lSlash = lName.indexOf('/'); - if (lSlash > 0) { - lAfterSlash = lName.substr(lSlash); - lName = Util.removeStr(lName, lAfterSlash); + slash = name.indexOf('/'); + if (slash > 0) { + afterSlash = name.substr(slash); + name = Util.removeStr(name, afterSlash); } } - isContain = Util.isContainStr(lPath, '.js'); - if (!isContain) - lPath += '.js'; + isContain = Util.isContainStr(path, '.js'); - if (!CloudCmd[lName]) { - CloudCmd[lName] = function(pArg) { - var path = CloudCmd.LIBDIRCLIENT + lPath; + if (!isContain) + path += '.js'; + + if (!CloudCmd[name]) { + CloudCmd[name] = function(arg) { + path = CloudCmd.LIBDIRCLIENT + path; - Util.exec(lDoBefore); + Util.exec(doBefore); - return DOM.jsload(path, lFunc || + return DOM.jsload(path, func || function() { - var Proto = CloudCmd[lName]; + var Proto = CloudCmd[name]; if (Util.isFunction(Proto)) - CloudCmd[lName] = new Proto(pArg); + CloudCmd[name] = new Proto(arg); }); }; - CloudCmd[lName].show = CloudCmd[lName]; + CloudCmd[name].show = CloudCmd[name]; } } }