Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
config.status[item] ? onCallback() : setTimeout(poll, 4);
}());
}
}
//回调
function onCallback(){
exports.push(layui[item]);
apps.length > 1 ?
that.use(apps.slice(1), callback, exports)
: ( typeof callback === 'function' && callback.apply(layui, exports) );
}
//如果使用了 layui.all.js
if(apps.length === 0
|| (layui['layui.all'] && modules[item])
|| (!layui['layui.all'] && layui['layui.mobile'] && modules[item])
){
return onCallback(), that;
}
//首次加载模块
if(!config.modules[item]){
var node = doc.createElement('script')
//如果是内置模块,则按照 dir 参数拼接模块路径
//如果是扩展模块,则判断模块路径值是否为 {!} 开头,
// 如果路径值是 {/} 开头,则模块路径即为后面紧跟的字符。
// 否则,则按照 base 参数拼接模块路径
,url = ( modules[item] ? (dir + 'lay/')
: (/^\{\/\}/.test(that.modules[item]) ? '' : (config.base || ''))
) + (that.modules[item] || item) + '.js';
config.status[item] ? onCallback() : setTimeout(poll, 4);
}());
}
}
//回调
function onCallback(){
exports.push(layui[item]);
apps.length > 1 ?
that.use(apps.slice(1), callback, exports)
: ( typeof callback === 'function' && callback.apply(layui, exports) );
}
//如果使用了 layui.all.js
if(apps.length === 0
|| (layui['layui.all'] && modules[item])
|| (!layui['layui.all'] && layui['layui.mobile'] && modules[item])
){
return onCallback(), that;
}
//首次加载模块
if(!config.modules[item]){
var node = doc.createElement('script')
//如果是内置模块,则按照 dir 参数拼接模块路径
//如果是扩展模块,则判断模块路径值是否为 {/} 开头,
//如果路径值是 {/} 开头,则模块路径即为后面紧跟的字符。
//否则,则按照 base 参数拼接模块路径
,url = ( modules[item] ? (dir + 'lay/')
: (/^\{\/\}/.test(that.modules[item]) ? '' : (config.base || ''))
) + (that.modules[item] || item) + '.js';
Layui.prototype.define = function(deps, factory){
var that = this, type = typeof deps === 'function', callback = function(){
var setApp = function(app, exports){
layui[app] = exports;
config.status[app] = true;
};
typeof factory === 'function' && factory(function(app, exports){
setApp(app, exports);
config.callback[app] = function(){
factory(setApp);
}
});
return this;
};
type && (factory = deps,deps = []);
if(layui['layui.all'] || (!layui['layui.all'] && layui['layui.mobile'])){
return callback.call(that);
}
that.use(deps, callback);
return that;
};
};
typeof factory === 'function' && factory(function(app, exports){
setApp(app, exports);
config.callback[app] = function(){
factory(setApp);
}
});
return this;
};
type && (
factory = deps,
deps = []
);
if(layui['layui.all'] || (!layui['layui.all'] && layui['layui.mobile'])){
return callback.call(that);
}
that.use(deps, callback);
return that;
};
n.prototype.cache = o, n.prototype.define = function (e, t) {
var n = this, r = "function" == typeof e, i = function () {
var e = function (e, t) {
layui[e] = t, o.status[e] = !0
};
return "function" == typeof t && t(function (n, r) {
e(n, r), o.callback[n] = function () {
t(e)
}
}), this
};
return r && (t = e, e = []), layui["layui.all"] || !layui["layui.all"] && layui["layui.mobile"] ? i.call(n) : (n.use(e, i), n)
}, n.prototype.use = function (e, n, l) {
function s(e, t) {
};
typeof factory === 'function' && factory(function(app, exports){
setApp(app, exports);
config.callback[app] = function(){
factory(setApp);
}
});
return this;
};
type && (
factory = deps,
deps = []
);
if(layui['layui.all'] || (!layui['layui.all'] && layui['layui.mobile'])){
return callback.call(that);
}
that.use(deps, callback);
return that;
};