1d82f671a3
Fixes #35539. git-svn-id: https://develop.svn.wordpress.org/trunk@36352 602fd350-edb4-49c9-b593-d223f7449a82
38 lines
698 B
JavaScript
38 lines
698 B
JavaScript
(function(exports) {
|
|
exports.AMDLC_TESTS = true;
|
|
|
|
function resolve(id) {
|
|
var i, target = exports, fragments = id.split(/[.\/]/);
|
|
|
|
for (i = 0; i < fragments.length; i++) {
|
|
if (!target[fragments[i]]) {
|
|
return;
|
|
}
|
|
|
|
target = target[fragments[i]];
|
|
}
|
|
|
|
return target;
|
|
}
|
|
|
|
function require(ids, callback) {
|
|
var i, module, defs = [], privateModules = exports.privateModules || {};
|
|
|
|
for (i = 0; i < ids.length; i++) {
|
|
module = privateModules[ids[i]] || resolve(ids[i]);
|
|
|
|
if (!module) {
|
|
throw 'module definition dependency not found: ' + ids[i];
|
|
}
|
|
|
|
defs.push(module);
|
|
}
|
|
|
|
callback.apply(null, defs);
|
|
}
|
|
|
|
exports.ModuleLoader = {
|
|
require: require
|
|
};
|
|
})(this);
|