-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmicroloader.js
61 lines (56 loc) · 1.52 KB
/
microloader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
if (typeof require == 'undefined'){
require = function(arg1, arg2){
var mid,
deps = [],
def,
i;
if (arg1.cache){
for (i in arg1.cache){
require.cache[i] = arg1.cache[i];
}
return;
}
for (i = 0; i < arg1.length; i++){
mid = arg1[i];
if (mid == 'mystique/messages!'){
deps.push(require.cache['url:mystique-common/translations/messages.json']);
} else {
if (!require.defs[mid]){
define.loadingMid = mid;
require.cache[mid]();
}
def = require.defs[mid];
deps.push(require(def.deps, def.factory));
}
}
return arg2.apply({}, deps);
}
require.micro = true;
require.cache = {};
require.defs = {};
define = function(arg1, arg2, arg3){
var mid,
deps,
factory,
factoryFactory = function(result){
return function(){return result};
};
if (typeof arg1 == 'string'){
mid = arg1;
deps = arg2;
factory = arg3;
} else {
mid = define.loadingMid;
deps = arg1;
factory = arg2;
}
if (!factory){
factory = factoryFactory(deps);
deps = [];
}
require.defs[mid] = {
deps: deps,
factory: factory
}
}
}