-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
69 lines (65 loc) · 1.73 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!doctype html>
<html lang="en" data-framework="typescript">
<head>
<meta name=viewport content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<style type="text/css">body { max-width: 800px; margin: auto; }</style>
<title>React TypeScript and Google Closure Compiler Hello World</title>
</head>
<body>
<div id="app" class="todoapp"></div>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
(function($) {
var loadScript = function(location) {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = location;
document.head.append(script);
}
var loadMain = function() {
$.ajax({
url: "dist/main.js",
dataType: "text",
success: function(data, textSuccess, jqXHR) {
loadScript("dist/main.js");
console.log("Loaded Main");
},
error: function(jqXHR, textStatus, errorThrown) {
console.log("Error: " + errorThrown + " loading Main");
}
});
}
var loadCommon = function() {
$.ajax({
url: "dist/common.js",
dataType: "text",
success: function(data, textSuccess, jqXHR) {
loadScript("dist/common.js");
console.log("Loaded Common");
loadMain();
},
error: function(jqXHR, textStatus, errorThrown) {
console.log("Error: " + errorThrown + " loading Common");
}
});
}
var loadBundle = function() {
$.ajax({
url: "dist/bundle.js",
dataType: "text",
success: function(data, textSuccess, jqXHR) {
loadScript("dist/bundle.js");
console.log("Loaded Bundle");
},
error: function(jqXHR, textStatus, errorThrown) {
console.log("Bundle not found trying to load common");
loadCommon();
}
});
}
loadBundle();
})(jQuery);
</script>
</body>
</html>