Ai
2 Star 0 Fork 0

mirrors_WebReflection/js_modules

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
require.js 1.76 KB
一键复制 编辑 原始数据 按行查看 历史
Andrea Giammarchi 提交于 2012-09-07 05:27 +08:00 . first module in
/*! (C) Andrea Giammarchi
* @link https://github.com/WebReflection/require_client
*/
var require = function (global, Function, config) {
//:dev //will be removed at build time
function grab(path, normalize) {
if (normalize) {
return (config.path + path) + ".js";
//return (config.path + path).replace(/\.js$/, "") + ".js";
} else {
var xhr = new XMLHttpRequest;
xhr.open("get", grab(path, TRUE), !TRUE);
xhr.send(null);
return xhr.responseText;
}
}
//dev:function grab(path, normalize) {return normalize ? path : modules[path]}
function retrieve(path) {
var
exports = cache[path] = {},
module = {
id: path,
parent: global,
filename: grab(path, TRUE),
web: TRUE // require client
}
;
module[EXPORTS] = exports;
Function(
"global", "module", EXPORTS,
(config.strict ?
"'use strict';" : ""
) + grab(path)
).call(exports,
global, module, exports
);
hasOP.call(
exports = module[EXPORTS],
LOADED
) || (exports[LOADED] = TRUE);
return exports;
}
function require(module) {
return hasOP.call(cache, module) ?
cache[module] :
cache[module] = retrieve(module)
;
}
var
EXPORTS = "exports",
LOADED = "loaded",
TRUE = !0,
cache = {},
hasOP = cache.hasOwnProperty,
modules = {production:1},
noConflicts = global.require
;
require._ = function _(enrich) {
for(var key in enrich) {
hasOP.call(enrich, key) && (
modules[key] = enrich[key]
);
}
return require;
};
require.config = config;
require.main = global;
return noConflicts ? noConflicts._(modules) : require;
}(this, Function, {strict:true, path:"js/"});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_WebReflection/js_modules.git
git@gitee.com:mirrors_WebReflection/js_modules.git
mirrors_WebReflection
js_modules
js_modules
master

搜索帮助