web-apps/vendor/requirejs/tests/error/globalOnError.html
Maxim Kadushkin 741b10515d webapps added
2016-03-10 21:48:53 -03:00

49 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>require.js: Global onError 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 master = new doh.Deferred(),
failed = false;
requirejs.onError = function (err) {
if (!failed) {
master.callback(true);
}
};
define('a', {name: 'a'});
require(['a'], function (a) {
a.whatever.fail = 'fail';
}, function (err) {
failed = true;
});
doh.register(
"globalOnError",
[
{
name: "globalOnError",
timeout: 1000,
runTest: function () {
return master;
}
}
]
);
doh.run();
</script>
</head>
<body>
<h1>require.js: Global onError Test</h1>
<p>If global onError function set up, favor using it even for require
callback errors.
<a href="https://github.com/jrburke/requirejs/issues/721">More info</a>.</p>
<p>Check console for messages</p>
</body>
</html>