aboutsummaryrefslogtreecommitdiff
path: root/picarones-elm/display.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--picarones-elm/display.html34
1 files changed, 34 insertions, 0 deletions
diff --git a/picarones-elm/display.html b/picarones-elm/display.html
new file mode 100644
index 0000000..88bebf1
--- /dev/null
+++ b/picarones-elm/display.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Main</title>
+ <script src="Display.js"></script>
+ <link rel="stylesheet" type="text/css" href="document.css" />
+</head>
+
+<body>
+ <div id="elm"></div>
+ <script>
+ let args = location.hash.split("#").slice(1);
+
+ var app = Elm.Display.init({
+ node: document.getElementById('elm'),
+ flags: [args[0], parseInt(args[1])]
+ });
+
+ let ws = new WebSocket("{{ serverurl }}")
+
+ ws.onopen = () => ws.send (JSON.stringify ({room:args[0]}));
+
+ ws.onmessage = function(msg) {
+ console.log(msg.data)
+ app.ports.recvPort.send(msg.data)
+ }
+
+ app.ports.sendPort.subscribe(function(msg) {
+ ws.send(msg)
+ })
+ </script>
+</body>
+</html>