web-apps/vendor/requirejs/tests/undef/undefNoRequire2.html

53 lines
1.5 KiB
HTML
Raw Normal View History

2016-03-11 00:48:53 +00:00
<!DOCTYPE html>
<html>
<head>
<title>require.js: requirejs.undef() No Require 2 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();
doh.register(
"undefNoRequire",
[
{
name: "undefNoRequire",
timeout: 2000,
runTest: function () {
return master;
}
}
]
);
doh.run();
//Start with a bad definition we want to overwrite
define('abc', function() {
master.errback(false);
});
define('b', {});
//Should remove that waiting 'abc' definition
requirejs.undef('abc');
//Now set the final version.
define('abc', function() {
master.callback(true);
});
//And now fully execute the module.
require(['abc'], function() {});
</script>
</head>
<body>
<h1>require.js: requirejs.undef() No Require 2 Test</h1>
<p>Use requirejs.undef() to reset, but called before the first require()
for the module. Like undefRequire.html, but with another module in the queue.
<a href="https://github.com/jrburke/requirejs/issues/925">More info</a>.</p>
<p>Check console for messages</p>
</body>
</html>