forked from requirejs/requirejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpriority.js
More file actions
56 lines (51 loc) · 1.29 KB
/
priority.js
File metadata and controls
56 lines (51 loc) · 1.29 KB
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
var master = new doh.Deferred(),
count = 0;
doh.register(
"priority",
[
{
name: "priority",
timeout: 5000,
runTest: function () {
return master;
}
}
]
);
doh.run();
require(
{
baseUrl: "./",
priority: ["one", "two"]
},
["alpha", "beta", "gamma", "epsilon"],
function (alpha, beta, gamma, epsilon) {
count += 1;
//Make sure callback is only called once.
doh.is(1, count);
doh.is("alpha", alpha.name);
doh.is("beta", alpha.betaName);
doh.is("beta", beta.name);
doh.is("gamma", beta.gammaName);
doh.is("gamma", gamma.name);
doh.is("theta", gamma.thetaName);
doh.is("epsilon", gamma.epsilonName);
doh.is("epsilon", epsilon.name);
}
);
function verifyFunc() {
var regExp = /alpha|beta|gamma|theta/,
i,
scripts = document.getElementsByTagName("script");
for (i = scripts.length - 1; i > -1; i--) {
doh.f(regExp.test(scripts[i].src));
}
master.callback(true);
}
//Account for requiring this test with a version of require.js that
//does not have require.ready built in.
if (require.ready) {
require.ready(verifyFunc);
} else {
setTimeout(verifyFunc, 3000);
}