aboutsummaryrefslogtreecommitdiff
path: root/picarones-elm/slide.html
diff options
context:
space:
mode:
Diffstat (limited to 'picarones-elm/slide.html')
-rw-r--r--picarones-elm/slide.html34
1 files changed, 34 insertions, 0 deletions
diff --git a/picarones-elm/slide.html b/picarones-elm/slide.html
new file mode 100644
index 0000000..a72fb3c
--- /dev/null
+++ b/picarones-elm/slide.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Main</title>
+ <script src="Main.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.Main.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>