-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlive.sh
More file actions
67 lines (52 loc) · 1.79 KB
/
live.sh
File metadata and controls
67 lines (52 loc) · 1.79 KB
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
cat <<——— > index2.html
<!doctype html>
<! -- THIS IS AN AUTOGENERATED FILE!!! MODIFICATIONS WILL BE OVERWRITETN -->
<! -- PLEASE UPDATE live.sh instead -->
<head>
<link rel="stylesheet" href="style.css" />
<script src="elm.js"></script>
<script src="vendor/viz/viz.js"></script>
<script src="vendor/viz/full.render.js"></script
</head>
<body>
<div id="svg-container"></div>
<div id="paper-svg-container"></div>
<div id="elm"></div>
<script>
var viz = new Viz();
var vizPaperOutline = new Viz();
</script>
<script>
var app = Elm.Main.init({ node: document.getElementById("elm") })
var svgContainer = document.getElementById("svg-container");
var paperSvgContainer = document.getElementById("paper-svg-container");
app.ports.repaintGraph.subscribe(function (dotOutput) {
viz.renderSVGElement(dotOutput)
.then(function(element) {
svgContainer.innerHTML = "";
svgContainer.appendChild(element);
})
.catch(error => {
// Create a new Viz instance (@see Caveats page for more info)
viz = new Viz();
// Possibly display the error
console.error(error);
});
})
app.ports.renderPaperOutline.subscribe(function (dotOutput) {
vizPaperOutline.renderSVGElement(dotOutput)
.then(function(element) {
paperSvgContainer.innerHTML = "";
paperSvgContainer.appendChild(element);
})
.catch(error => {
// Create a new Viz instance (@see Caveats page for more info)
vizPaperOutline = new Viz();
// Possibly display the error
console.error(error);
});
})
</script>
</body>
———
elm-live src/Main.elm --open -- --output=elm.js