69 lines
2.2 KiB
HTML
69 lines
2.2 KiB
HTML
<!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>
|