-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
35 lines (27 loc) · 846 Bytes
/
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
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script type="text/javascript" src="/elm.js"></script>
<script type="text/javascript" src="/assets/dagre.min.js"></script>
<head>
<body>
<div id="elm"></div>
<script type="text/javascript">
//var dagre = require("dagre");
var app = Elm.Main.init({
node: document.getElementById("elm")
});
app.ports.layout.subscribe((data) => {
//console.log(data);
var g = dagre.graphlib.json.read(JSON.parse(data));
dagre.layout(g);
//console.dir(g.graph());
var graph = dagre.graphlib.json.write(g);
//console.dir(graph);
app.ports.graphs.send(graph);
});
</script>
</body>
</html>