forked from requirejs/requirejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefineErrorLocal.html
More file actions
68 lines (64 loc) · 2.15 KB
/
defineErrorLocal.html
File metadata and controls
68 lines (64 loc) · 2.15 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
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html>
<head>
<title>require.js: Define Error Local Test</title>
<script type="text/javascript" src="../../require.js"></script>
<script type="text/javascript" src="../doh/runner.js"></script>
<script type="text/javascript" src="../doh/_browserRunner.js"></script>
<script type="text/javascript">
var doneCount = 0;
var master = new doh.Deferred();
function done() {
doneCount += 1;
if (doneCount == 2) {
master.callback(true);
}
}
requirejs({
waitSeconds: 2
}, ['b', 'defineError'], function (b, defineError) {
doh.is("shouldNotBeReached", b.name);
done();
}, function (err) {
if (err.requireType === 'define') {
requirejs(['c', 'd'], function (c, d) {
doh.is('c', c.name);
doh.is('a', c.a.name);
doh.is('d', d.name);
doh.is('b', d.b.name);
setTimeout(function () {
//Ask for the broken thing again, should get error
//handler still called.
requirejs(['defineError'], function (de) {
doh.is("shouldNotBeReached", de.name);
done();
}, function (err) {
doh.is("define", err.requireType);
done();
});
}, 10);
done();
});
}
});
doh.register(
"defineErrorLocal",
[
{
name: "defineErrorLocal",
timeout: 5000,
runTest: function () {
return master;
}
}
]
);
doh.run();
</script>
</head>
<body>
<h1>require.js: Define Error Local Test</h1>
<p>A factory function error calls the local error handler and later loads still work.</p>
<p>Check console for messages</p>
</body>
</html>