-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
45 lines (37 loc) · 1.17 KB
/
index.html
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
<html>
<head>
<title>RequireJS</title>
<!--
Step 1 - Load require.js configuration, this is done as early as possible. See "Step 1.1"
below for details...
-->
<script src="scripts/require-config.js"></script>
<!--
Step 5 - Load require.js and make it run main.js
-->
<script src="scripts/require.js" data-main="scripts/main"></script>
<!--
Step 1.1. Calling require() this way wouldn't work if the requirejs configuration was
loaded in 'main.js' instead of 'require-config.js'. If we did that, this script below would be
executed before 'main.js' and thefore, the path for 'jquery' would not be loaded yet.
-->
<script type="text/javascript">
require(['jquery'], function ($) {
if ($ === undefined)
{
alert("broken!");
}
})
</script>
</head>
<body>
<p>This page shows a few RequireJS use cases including:</p>
<ul>
<li>Loading jQuery without using the prebuldeled require-jquery.js</li>
<li>Defining modules</li>
<li>Loading modules</li>
<li>Using "legacy" scripts as AMD modules using shims</li>
</ul>
<p>Open the source code starting from index.html and follow the comments labeled "Step 1 -" to "Step 8-".</p>
</body>
</html>